author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:55:58 +0300 | |
branch | RCL_3 |
changeset 56 | 8152b1f1763a |
parent 44 | ecbabf52600f |
permissions | -rw-r--r-- |
44 | 1 |
/* |
2 |
* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Implementation for finger hwr UiLayout |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
//SYSTEM INCLUDES |
|
19 |
#include <bautils.h> |
|
20 |
#include <coemain.h> |
|
21 |
#include <CommonEngineDomainCRKeys.h> |
|
22 |
//FEP Includes |
|
23 |
#include <AknFepGlobalEnums.h> |
|
24 |
#include <aknfeppeninputenums.h> |
|
25 |
#include <peninputlayoutchoicelist.h> |
|
26 |
#include <settingsinternalcrkeys.h> |
|
27 |
#include <centralrepository.h> |
|
28 |
#include <peninputlayoutvkb.h> |
|
29 |
#include <peninputcmdparam.h> |
|
30 |
#include <peninputdropdownlist.h> |
|
31 |
#include <peninputlayoutmultilineicf.h> |
|
32 |
||
33 |
//USER INCLUDES |
|
34 |
#include "peninputfingerhwrardatastore.h" |
|
35 |
#include "peninputfingerhwrarstatemanager.h" |
|
36 |
#include "peninputfingerhwrarevent.h" |
|
37 |
#include "peninputfingerhwrarlayout.h" |
|
38 |
#include "peninputfingerhwrarcontrolid.h" |
|
39 |
||
40 |
#include "peninputfingerhwrarwnd.h" |
|
41 |
#include "peninputfingerhwrarwnd.rsg" |
|
42 |
||
43 |
//CONST DEFINATION |
|
44 |
_LIT( KFSHWRRssFile, "\\resource\\peninputfingerhwrarwnd.rsc" ); |
|
45 |
||
46 |
const TUint8 KTempBufSize = 8; |
|
47 |
const TUint8 KIntLen = sizeof(TInt)/2; |
|
48 |
const TUint8 KIntSize = sizeof(TInt); |
|
49 |
||
50 |
const TInt16 KEmotionKeyMark = 0xFFFE; |
|
51 |
||
56
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
52 |
class CPeninputFingerHwrArCallBack : public CActive |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
53 |
{ |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
54 |
friend class CPeninputFingerHwrArLayout; |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
55 |
public: |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
56 |
void IssueRequestL(); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
57 |
private: |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
58 |
CPeninputFingerHwrArCallBack(CPeninputFingerHwrArLayout* aHwrArLayout); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
59 |
void RunL(); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
60 |
void DoCancel(); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
61 |
private: |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
62 |
CPeninputFingerHwrArLayout* iHwrArLayout; |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
63 |
}; |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
64 |
|
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
65 |
CPeninputFingerHwrArCallBack::CPeninputFingerHwrArCallBack(CPeninputFingerHwrArLayout* aHwrArLayout) |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
66 |
:CActive(EPriorityHigh) |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
67 |
{ |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
68 |
CActiveScheduler::Add(this); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
69 |
iHwrArLayout = aHwrArLayout; |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
70 |
} |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
71 |
void CPeninputFingerHwrArCallBack::IssueRequestL() |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
72 |
{ |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
73 |
if(!IsActive()) |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
74 |
{ |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
75 |
iStatus=KRequestPending; |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
76 |
SetActive(); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
77 |
TRequestStatus *pS=(&iStatus); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
78 |
|
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
79 |
User::RequestComplete(pS,0); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
80 |
} |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
81 |
} |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
82 |
void CPeninputFingerHwrArCallBack::RunL() |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
83 |
{ |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
84 |
iHwrArLayout->CallBackL(); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
85 |
} |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
86 |
|
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
87 |
void CPeninputFingerHwrArCallBack::DoCancel() |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
88 |
{ |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
89 |
|
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
90 |
} |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
91 |
|
44 | 92 |
// ============================ MEMBER FUNCTIONS ============================= |
93 |
||
94 |
// --------------------------------------------------------------------------- |
|
95 |
// Symbian Constructor |
|
96 |
// --------------------------------------------------------------------------- |
|
97 |
// |
|
98 |
CPeninputFingerHwrArLayout* CPeninputFingerHwrArLayout::NewL( |
|
99 |
MLayoutOwner* aLayoutOwner, const TAny* aInitData ) |
|
100 |
{ |
|
101 |
CPeninputFingerHwrArLayout* self = new( ELeave ) CPeninputFingerHwrArLayout( |
|
102 |
aLayoutOwner ); |
|
103 |
||
104 |
CleanupStack::PushL( self ); |
|
105 |
self->ConstructL( aInitData ); |
|
106 |
CleanupStack::Pop( self ); //self |
|
107 |
return self; |
|
108 |
} |
|
109 |
||
110 |
// --------------------------------------------------------------------------- |
|
111 |
// Symbian second-phase constructor |
|
112 |
// --------------------------------------------------------------------------- |
|
113 |
// |
|
114 |
void CPeninputFingerHwrArLayout::ConstructL( const TAny* aInitData ) |
|
115 |
{ |
|
116 |
BaseConstructL(); |
|
117 |
//load resource |
|
118 |
TFileName resFileName( KFSHWRRssFile ); |
|
119 |
CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
120 |
BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resFileName ); |
|
121 |
iResId = coeEnv->AddResourceFileL( resFileName ); |
|
122 |
||
123 |
//initialze the data store |
|
124 |
TPeninputLayoutData* layoutData = ( TPeninputLayoutData* )aInitData; |
|
125 |
||
126 |
iDataStore = CPeninputFingerHwrArDataStore::NewL( (*layoutData).iPtiEngine, this ); |
|
127 |
||
128 |
//create the repository for gereral settings |
|
129 |
iRepositorySetting = CRepository::NewL( KCRUidPersonalizationSettings ); |
|
130 |
//create the repository watcher for general settings |
|
131 |
iGSRepositoryWatcher = CAknFepRepositoryWatcher::NewL( |
|
132 |
KCRUidPersonalizationSettings, |
|
133 |
TCallBack( HandleGSRepositoryCallBack, this ), |
|
134 |
iRepositorySetting ); |
|
135 |
||
136 |
//create state manager |
|
137 |
CreateStateManagerL(); |
|
138 |
||
139 |
//create the arabic window control |
|
140 |
CreateHwrWindowL(); |
|
141 |
||
142 |
//retrieve the settings |
|
143 |
LoadAndPublishDefaultL(); |
|
56
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
144 |
|
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
145 |
//iCallBack = new (ELeave) CPeninputFingerHwrArCallBack(this); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
146 |
|
44 | 147 |
//set screen layout extent |
148 |
SetRect( TRect( TPoint( 0, 0 ), ScreenSize() ) ); |
|
149 |
} |
|
150 |
||
151 |
// --------------------------------------------------------------------------- |
|
152 |
// handle the command from Fep. |
|
153 |
// --------------------------------------------------------------------------- |
|
154 |
// |
|
155 |
TInt CPeninputFingerHwrArLayout::HandleCommand( const TInt aCmd, TUint8* aData ) |
|
156 |
{ |
|
157 |
TInt ret = KErrUnknown; |
|
158 |
TRAPD(err, ret = HandleCommandL( aCmd, aData ) ); |
|
159 |
if ( err ) |
|
160 |
{ |
|
161 |
return KErrUnknown; |
|
162 |
} |
|
163 |
else |
|
164 |
{ |
|
165 |
return ret; |
|
166 |
} |
|
167 |
} |
|
168 |
||
169 |
// --------------------------------------------------------------------------- |
|
170 |
// handle the command from Fep. |
|
171 |
// --------------------------------------------------------------------------- |
|
172 |
// |
|
173 |
TInt CPeninputFingerHwrArLayout::HandleCommandL( const TInt aCmd, TUint8* aData ) |
|
174 |
{ |
|
175 |
if ( CFepUiLayout::HandleCommand( aCmd, aData ) == KErrNone ) |
|
176 |
{ |
|
177 |
return KErrNone; |
|
178 |
} |
|
179 |
||
180 |
TInt ret = KErrNone; |
|
181 |
switch ( aCmd ) |
|
182 |
{ |
|
183 |
case ECmdPenInputEditorNumericKeyMap: |
|
184 |
{ |
|
185 |
iDataStore->SetNumberMode( *(TAknEditorNumericKeymap*)aData ); |
|
186 |
OnNumMappingChangedL(); |
|
187 |
} |
|
188 |
break; |
|
189 |
case ECmdPenInputEditorCustomNumericKeyMap: |
|
190 |
{ |
|
191 |
TInt len = *( TInt* )( aData - KIntSize ); |
|
192 |
TPtrC16 keymapRes( (TUint16*)aData, len / 2 ); |
|
193 |
iDataStore->SetCustomNumberModeL( keymapRes ); |
|
194 |
} |
|
195 |
break; |
|
196 |
case ECmdPenInputPermittedRange: |
|
197 |
{ |
|
198 |
TInt ranges = *(TInt*)aData; |
|
199 |
iDataStore->SetPermittedRanges( ranges ); |
|
200 |
} |
|
201 |
break; |
|
202 |
case ECmdPenInputLanguage: |
|
203 |
{ |
|
204 |
TInt language = *( TInt* )aData; |
|
205 |
iDataStore->SetLanguageL( language ); |
|
206 |
if(iHwrWnd) |
|
207 |
{ |
|
208 |
iHwrWnd->SetIcfLanguage(language); |
|
209 |
} |
|
210 |
} |
|
211 |
break; |
|
212 |
case ECmdPenInputPermittedCase: |
|
213 |
{ |
|
214 |
TInt cs = *( TInt* )aData; |
|
215 |
iDataStore->SetPermittedCases( cs ); |
|
216 |
} |
|
217 |
break; |
|
218 |
case ECmdPenInputCase: |
|
219 |
{ |
|
220 |
TInt cs = *( TInt* )aData; |
|
221 |
iDataStore->SetCase( cs ); |
|
222 |
} |
|
223 |
break; |
|
224 |
case ECmdPenInputWindowOpen: |
|
225 |
{ |
|
226 |
LayoutOwner()->Hide( EFalse ); |
|
227 |
RootControl()->UpdateValidRegion( NULL, EFalse ); |
|
228 |
||
229 |
// tell the engine the hwr writing area |
|
230 |
TRect hwrRect = iHwrWnd->WritingBoxRect(); |
|
231 |
TSize hwrSize = hwrRect.Size(); |
|
232 |
iDataStore->SetInputAreaSize(hwrSize); |
|
233 |
iDataStore->SetScreenSize(hwrSize); |
|
234 |
||
235 |
// tell the HWR window to handle the window open command |
|
236 |
iHwrWnd->HandleWindowOpenCommandL(); |
|
237 |
||
238 |
// switch to standby state |
|
239 |
ChangeCurStateToStandby(); |
|
240 |
} |
|
241 |
break; |
|
242 |
case ECmdPenInputWindowClose: |
|
243 |
{ |
|
244 |
LayoutOwner()->Hide( ETrue ); |
|
245 |
} |
|
246 |
break; |
|
247 |
case ECmdPenInputSetTextAlignment: |
|
248 |
{ |
|
249 |
iHwrWnd->SetTextAlignmentL( *aData, ELangArabic ); |
|
250 |
} |
|
251 |
break; |
|
252 |
case ECmdPenInputSetPromptText: |
|
253 |
{ |
|
254 |
iHwrWnd->SetPromptTextL( aData ); |
|
255 |
} |
|
256 |
break; |
|
257 |
case ECmdPenInputDimArrowKeys: |
|
258 |
{ |
|
259 |
TBool IsDimArrowKeys = *aData; |
|
260 |
iHwrWnd->DimArrowKeys( IsDimArrowKeys ); |
|
261 |
} |
|
262 |
break; |
|
263 |
case ECmdPenInputCharacterPreview: |
|
264 |
{ |
|
265 |
iHwrWnd->ShowBubble(*aData); |
|
266 |
} |
|
267 |
break; |
|
268 |
case ECmdPenInputEnableSettingBtn: |
|
269 |
{ |
|
270 |
TBool isEnableSetting = *aData; |
|
271 |
iHwrWnd->SetEnableSettingBtn(isEnableSetting); |
|
272 |
} |
|
273 |
break; |
|
274 |
case ECmdPeninputArabicNumModeChanged: |
|
275 |
{ |
|
276 |
TBool isArabicNativeNum = *aData; |
|
277 |
iHwrWnd->SetNativeNumMode(isArabicNativeNum); |
|
278 |
} |
|
279 |
break; |
|
280 |
default: |
|
281 |
ret = KErrUnknown; |
|
282 |
break; |
|
283 |
} |
|
284 |
||
285 |
return ret; |
|
286 |
} |
|
287 |
||
288 |
// --------------------------------------------------------------------------- |
|
289 |
// handle size changing event. |
|
290 |
// --------------------------------------------------------------------------- |
|
291 |
// |
|
292 |
TInt CPeninputFingerHwrArLayout::SizeChanged( const TAny* /*pData*/ ) |
|
293 |
{ |
|
294 |
//Handle size change event |
|
295 |
SetRect( TRect( TPoint( 0, 0 ), ScreenSize() ) ); |
|
296 |
||
297 |
TRAP_IGNORE(iHwrWnd->SizeChangedL()); |
|
298 |
||
299 |
return KErrNone; |
|
300 |
} |
|
301 |
||
302 |
// --------------------------------------------------------------------------- |
|
303 |
// Handle editor text coming. |
|
304 |
// --------------------------------------------------------------------------- |
|
305 |
// |
|
306 |
TInt CPeninputFingerHwrArLayout::OnAppEditorTextComing( |
|
307 |
const TFepInputContextFieldData& aData ) |
|
308 |
{ |
|
309 |
if ( iHwrWnd ) |
|
310 |
{ |
|
311 |
TRAPD( err, iHwrWnd->SetEditorTextL( aData ) ); |
|
312 |
if(err != KErrNone) |
|
313 |
{ |
|
314 |
return err; |
|
315 |
} |
|
316 |
// |
|
317 |
// implement the feature: the candiates will be filtered according to the char after the cursor |
|
318 |
// |
|
319 |
||
320 |
// |
|
321 |
// As the icf will not insert the text coming from FEP Editor into iRichView |
|
322 |
// when EFepICFDataDirectionMFNE was set, |
|
323 |
// so if we are going to call iContextField->ExtractText(), it could cause a panic of |
|
324 |
// out of range. |
|
325 |
// no idea why icf behaves like this. |
|
326 |
// this is just a temporary solution to avoid this panic happened. |
|
327 |
// The best solution is to get the cusor postion which should be provide by ICF control |
|
328 |
// but ICF does not offer such API |
|
329 |
if(aData.iFlag & EFepICFDataDirectionMFNE ) |
|
330 |
{ |
|
331 |
iIsEditorMFNE = ETrue; |
|
332 |
return KErrNone; |
|
333 |
} |
|
334 |
||
335 |
iIsEditorMFNE = EFalse; |
|
336 |
iDataStore->SetFirstCandidateType(ECandDefaultFirst); |
|
337 |
// if(iDataStore->PrimaryRange() == ERangeEnglish) |
|
338 |
// { |
|
339 |
// return KErrNone; |
|
340 |
// } |
|
341 |
TUint16 charBeforeCursor = 0; |
|
342 |
||
343 |
if(iHwrWnd->GetCharBeforeCursor(aData.iCurSel.LowerPos()-1, charBeforeCursor)) |
|
344 |
{ |
|
345 |
TFirstCandidateType candtype = ECandDefaultFirst; |
|
346 |
if(iDataStore->IsLatinNumber(charBeforeCursor)) // latin number |
|
347 |
{ |
|
348 |
candtype = ECandLatinNumFirst; |
|
349 |
} |
|
350 |
else if(iDataStore->IsLatinChar(charBeforeCursor)) // uppercase & lowcase latin character |
|
351 |
{ |
|
352 |
candtype = ECandLatinCharFirst; |
|
353 |
} |
|
354 |
else if(iDataStore->IsArabicNumber(charBeforeCursor)) // arabic-indic numbers |
|
355 |
{ |
|
356 |
candtype = ECandArabicIndicNumFirst; |
|
357 |
} |
|
358 |
||
359 |
iDataStore->SetFirstCandidateType(candtype); |
|
360 |
} |
|
361 |
||
362 |
return KErrNone; |
|
363 |
} |
|
364 |
||
365 |
return KErrNone; |
|
366 |
} |
|
367 |
||
368 |
// --------------------------------------------------------------------------- |
|
369 |
// Handle application info change. |
|
370 |
// --------------------------------------------------------------------------- |
|
371 |
// |
|
372 |
void CPeninputFingerHwrArLayout::HandleAppInfoChange( const TDesC& aInfo, |
|
373 |
TPeninputAppInfo aType ) |
|
374 |
{ |
|
375 |
if ( aType == EAppIndicatorMsg ) |
|
376 |
{ |
|
377 |
TRAP_IGNORE( iHwrWnd->SetBubbleTextL( aInfo ) ); |
|
378 |
} |
|
379 |
} |
|
380 |
||
381 |
// --------------------------------------------------------------------------- |
|
382 |
// Called by owner when the system resource changed event. |
|
383 |
// --------------------------------------------------------------------------- |
|
384 |
// |
|
385 |
TInt CPeninputFingerHwrArLayout::OnResourceChange( TInt aType ) |
|
386 |
{ |
|
387 |
CFepUiLayout::OnResourceChange( aType ); |
|
388 |
if ( aType == KAknsMessageSkinChange ) |
|
389 |
{ |
|
390 |
//Do other things when skin change |
|
391 |
TInt newValue = GetPenTrailColor(); |
|
392 |
SetBoxPenColor(newValue); |
|
393 |
} |
|
394 |
return KErrNone; |
|
395 |
} |
|
396 |
||
397 |
// --------------------------------------------------------------------------- |
|
398 |
// get the peninput ui type. |
|
399 |
// --------------------------------------------------------------------------- |
|
400 |
// |
|
401 |
TInt CPeninputFingerHwrArLayout::PenInputType() |
|
402 |
{ |
|
403 |
return EPluginInputModeFingerHwr; |
|
404 |
} |
|
405 |
||
406 |
// --------------------------------------------------------------------------- |
|
407 |
// Called by owner when the layout is going to be hidden. |
|
408 |
// --------------------------------------------------------------------------- |
|
409 |
// |
|
410 |
void CPeninputFingerHwrArLayout::OnDeActivate() |
|
411 |
{ |
|
412 |
ChangeCurStateToStandby(); |
|
413 |
||
414 |
CFepUiLayout::OnDeActivate(); |
|
415 |
} |
|
416 |
||
417 |
// --------------------------------------------------------------------------- |
|
418 |
// handle control event. |
|
419 |
// --------------------------------------------------------------------------- |
|
420 |
// |
|
421 |
void CPeninputFingerHwrArLayout::HandleControlEvent( TInt aEventType, |
|
422 |
CFepUiBaseCtrl* aCtrl, const TDesC& aEventData ) |
|
423 |
{ |
|
424 |
TRAP_IGNORE( HandleControlEventL( aEventType, aCtrl, aEventData ) ); |
|
425 |
} |
|
426 |
||
427 |
// --------------------------------------------------------------------------- |
|
428 |
// handle control event. |
|
429 |
// --------------------------------------------------------------------------- |
|
430 |
// |
|
431 |
void CPeninputFingerHwrArLayout::HandleControlEventL( TInt aEventType, |
|
432 |
CFepUiBaseCtrl* aCtrl, const TDesC& aEventData ) |
|
433 |
{ |
|
434 |
||
435 |
switch ( aEventType ) |
|
436 |
{ |
|
437 |
case EEventButtonDown: |
|
438 |
{ |
|
439 |
OnCtrlButtonDownL( aEventType, aCtrl, aEventData ); |
|
440 |
} |
|
441 |
break; |
|
442 |
case EEventButtonUp: |
|
443 |
{ |
|
444 |
OnCtrlButtonUpL( aEventType, aCtrl, aEventData ); |
|
445 |
} |
|
446 |
break; |
|
447 |
case EEventHwrCharacterTimerOut: |
|
448 |
{ |
|
449 |
OnHwrCharacterFinishedL(); |
|
450 |
} |
|
451 |
break; |
|
452 |
case EEventHwrStrokeStarted: |
|
453 |
{ |
|
454 |
OnHwrStrokeStartedL(); |
|
455 |
} |
|
456 |
break; |
|
457 |
case EEventHwrStrokeFinished: |
|
458 |
{ |
|
459 |
OnHwrStrokeFinishedL(); |
|
460 |
} |
|
461 |
break; |
|
462 |
case EHwrEventKeyBack: |
|
463 |
{ |
|
464 |
OnBackspaceClickedL(); |
|
465 |
} |
|
466 |
break; |
|
467 |
case EHwrEventNavKeyClicked: |
|
468 |
{ |
|
469 |
OnRepButtonClickedL( aCtrl, aEventData ); |
|
470 |
} |
|
471 |
break; |
|
472 |
case EEventVirtualKeyDown: |
|
473 |
{ |
|
474 |
OnVirtualKeyDownL( aCtrl, aEventData ); |
|
475 |
} |
|
476 |
break; |
|
477 |
case EEventVirtualKeyUp: |
|
478 |
{ |
|
479 |
OnVirtualKeyUpL( aCtrl, aEventData ); |
|
480 |
} |
|
481 |
break; |
|
482 |
case EHwrEventCandidateSelected: |
|
483 |
{ |
|
484 |
OnCandidateSelectedL( aCtrl, aEventData ); |
|
485 |
} |
|
486 |
break; |
|
487 |
case EEventIcfPointerUpEvent: |
|
488 |
{ |
|
489 |
OnIcfClicked(); |
|
490 |
} |
|
491 |
break; |
|
492 |
||
493 |
case EHwrEventOutsideEvent: |
|
494 |
{ |
|
495 |
ChangeCurStateToStandby(); |
|
496 |
} |
|
497 |
break; |
|
498 |
||
499 |
default: |
|
500 |
break; |
|
501 |
} |
|
502 |
} |
|
503 |
||
504 |
// --------------------------------------------------------------------------- |
|
505 |
// Get the data stroe object. |
|
506 |
// --------------------------------------------------------------------------- |
|
507 |
// |
|
508 |
CPeninputFingerHwrArDataStore& CPeninputFingerHwrArLayout::DataStore() |
|
509 |
{ |
|
510 |
return *iDataStore; |
|
511 |
} |
|
512 |
||
513 |
// --------------------------------------------------------------------------- |
|
514 |
// Delete the previous charcode and submit the new one |
|
515 |
// --------------------------------------------------------------------------- |
|
516 |
// |
|
517 |
void CPeninputFingerHwrArLayout::Replace( const TDesC& aOldCharCode, |
|
518 |
const TDesC& aNewCharCode, const TBool aIsPart) |
|
519 |
{ |
|
520 |
// user tries to correct the previous selection |
|
521 |
// Delete the previous character and append the new one |
|
522 |
HBufC* newCharBuf = HBufC::New( aNewCharCode.Length() + KIntLen ); |
|
523 |
if ( newCharBuf ) |
|
524 |
{ |
|
525 |
TInt len = aOldCharCode.Length(); |
|
526 |
if(len == 0 ) |
|
527 |
{ |
|
528 |
delete newCharBuf; |
|
529 |
return; |
|
530 |
} |
|
531 |
||
532 |
newCharBuf->Des().Append( ( TUint16* )&len, KIntLen ); |
|
533 |
newCharBuf->Des().Append( aNewCharCode ); |
|
534 |
if ( aIsPart ) |
|
535 |
{ |
|
536 |
SignalOwner( ESignalReplacePartText, *newCharBuf ); |
|
537 |
} |
|
538 |
else |
|
539 |
{ |
|
540 |
SignalOwner( ESignalReplaceText, *newCharBuf ); |
|
541 |
} |
|
542 |
delete newCharBuf; |
|
543 |
} |
|
544 |
} |
|
545 |
||
546 |
// --------------------------------------------------------------------------- |
|
547 |
// Submit string to layout owner. |
|
548 |
// --------------------------------------------------------------------------- |
|
549 |
// |
|
550 |
void CPeninputFingerHwrArLayout::SubmitStringToFep( const TDesC& aCharCode ) |
|
551 |
{ |
|
552 |
SignalOwner( ESignalKeyEvent, aCharCode ); |
|
553 |
} |
|
554 |
||
555 |
// --------------------------------------------------------------------------- |
|
556 |
// Submit char to layout owner. |
|
557 |
// --------------------------------------------------------------------------- |
|
558 |
// |
|
559 |
void CPeninputFingerHwrArLayout::SubmitCharToFep( const TInt aCharCode ) |
|
560 |
{ |
|
561 |
TBuf<1> buf; |
|
562 |
buf.Append( aCharCode ); |
|
563 |
SignalOwner( ESignalKeyEvent, buf ); |
|
564 |
} |
|
565 |
||
566 |
// --------------------------------------------------------------------------- |
|
567 |
// repository callback for settings. |
|
568 |
// --------------------------------------------------------------------------- |
|
569 |
// |
|
570 |
TInt CPeninputFingerHwrArLayout::HandleGSRepositoryCallBack( TAny* aPtr ) |
|
571 |
{ |
|
572 |
CPeninputFingerHwrArLayout *self = static_cast<CPeninputFingerHwrArLayout*>( aPtr ); |
|
573 |
||
574 |
CAknFepRepositoryWatcher* watcher = self->iGSRepositoryWatcher; |
|
575 |
if ( watcher ) |
|
576 |
{ |
|
577 |
TInt newValue = self->GetNewValue( watcher, watcher->ChangedKey() ); |
|
578 |
||
579 |
switch ( watcher->ChangedKey() ) |
|
580 |
{ |
|
581 |
case KSettingsWritingSpeed: |
|
582 |
{ |
|
583 |
self->SetWritingSpeed( newValue ); |
|
584 |
} |
|
585 |
break; |
|
586 |
case KSettingsPenColor: |
|
587 |
{ |
|
588 |
self->SetBoxPenColor( newValue ); |
|
589 |
} |
|
590 |
break; |
|
591 |
case KSettingsPenInputGuideLine: |
|
592 |
{ |
|
593 |
self->SetGuideLineOn(newValue); |
|
594 |
} |
|
595 |
break; |
|
596 |
default: |
|
597 |
break; |
|
598 |
} |
|
599 |
} |
|
600 |
return KErrNone; |
|
601 |
} |
|
602 |
||
603 |
// --------------------------------------------------------------------------- |
|
604 |
// load default settings. |
|
605 |
// --------------------------------------------------------------------------- |
|
606 |
// |
|
607 |
void CPeninputFingerHwrArLayout::LoadAndPublishDefaultL() |
|
608 |
{ |
|
609 |
if(!iRepositorySetting) |
|
610 |
{ |
|
611 |
return; |
|
612 |
} |
|
613 |
||
614 |
TInt newValue; |
|
615 |
||
616 |
iRepositorySetting->Get( KSettingsWritingSpeed, newValue ); |
|
617 |
SetWritingSpeed( newValue ); |
|
618 |
||
619 |
iRepositorySetting->Get(KSettingsPenInputGuideLine,newValue); |
|
620 |
SetGuideLineOn(newValue); |
|
621 |
||
622 |
iRepositorySetting->Get( KSettingsPenWidth, newValue ); |
|
623 |
SetBoxPenSize( TSize( newValue, newValue ) ); |
|
624 |
||
625 |
newValue = GetPenTrailColor(); |
|
626 |
SetBoxPenColor( newValue ); |
|
627 |
||
628 |
iRepositorySetting->Get( KSettingsPenInputLang, newValue ); |
|
629 |
iDataStore->SetLanguageL( newValue ); |
|
56
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
630 |
|
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
631 |
// TInt displayLang = 0; |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
632 |
// iCommonEngineRepository->Get(KGSDisplayTxtLang,displayLang); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
633 |
// if(displayLang == ELangArabic) |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
634 |
// { |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
635 |
// iHwrWnd->SetNativeNumMode(ETrue); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
636 |
// } |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
637 |
// else |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
638 |
// { |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
639 |
// iHwrWnd->SetNativeNumMode(EFalse); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
640 |
// } |
44 | 641 |
iHwrWnd->SetNativeNumMode(iDataStore->IsNativeNumMode()); |
642 |
} |
|
643 |
||
644 |
// --------------------------------------------------------------------------- |
|
645 |
// |
|
646 |
// --------------------------------------------------------------------------- |
|
647 |
// |
|
648 |
void CPeninputFingerHwrArLayout::SyncHwrStrokeEndMark( const TPoint& aEndMark ) |
|
649 |
{ |
|
650 |
iHwrWnd->SetStrokeEndMark( aEndMark ); |
|
651 |
} |
|
652 |
||
653 |
||
654 |
// private |
|
655 |
||
656 |
// --------------------------------------------------------------------------- |
|
657 |
// c++ constructor |
|
658 |
// --------------------------------------------------------------------------- |
|
659 |
// |
|
660 |
CPeninputFingerHwrArLayout::CPeninputFingerHwrArLayout( MLayoutOwner* aLayoutOwner ) |
|
661 |
: CFepUiLayout( aLayoutOwner ), iLastOverlapIdx(KInvalidIndex) |
|
662 |
{ |
|
663 |
} |
|
664 |
||
665 |
// --------------------------------------------------------------------------- |
|
666 |
// c++ destructor |
|
667 |
// --------------------------------------------------------------------------- |
|
668 |
// |
|
669 |
CPeninputFingerHwrArLayout::~CPeninputFingerHwrArLayout() |
|
670 |
{ |
|
671 |
CCoeEnv::Static()->DeleteResourceFile( iResId ); |
|
672 |
||
673 |
delete iDataStore; |
|
674 |
delete iStateMgr; |
|
675 |
delete iGSRepositoryWatcher; |
|
676 |
delete iRepositorySetting; |
|
56
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
677 |
// delete iCommonEngineRepository; |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
678 |
//delete iCallBack; |
44 | 679 |
} |
680 |
||
681 |
// --------------------------------------------------------------------------- |
|
682 |
// Create the hwr box window. |
|
683 |
// --------------------------------------------------------------------------- |
|
684 |
// |
|
685 |
void CPeninputFingerHwrArLayout::CreateHwrWindowL() |
|
686 |
{ |
|
687 |
iHwrWnd = CPeninputFingerHwrArWnd::NewL( this, EHwrCtrlIdHwrWindow, EFalse ); |
|
688 |
||
689 |
iHwrWnd->SetResourceId( R_FINGERHWR_WINDOW ); |
|
690 |
iHwrWnd->ConstructFromResourceL(); |
|
691 |
||
692 |
iHwrWnd->SetStrokeEndMark( iDataStore->StrokeEndMark() ); |
|
693 |
||
694 |
AddControlL( iHwrWnd, EFalse ); |
|
695 |
} |
|
696 |
||
697 |
// --------------------------------------------------------------------------- |
|
698 |
// Create the state manager. |
|
699 |
// --------------------------------------------------------------------------- |
|
700 |
// |
|
701 |
void CPeninputFingerHwrArLayout::CreateStateManagerL() |
|
702 |
{ |
|
703 |
iStateMgr = CPeninputFingerHwrArStateManager::NewL( this ); |
|
704 |
} |
|
705 |
||
706 |
// --------------------------------------------------------------------------- |
|
707 |
// handler of button down event. |
|
708 |
// --------------------------------------------------------------------------- |
|
709 |
// |
|
710 |
void CPeninputFingerHwrArLayout::OnCtrlButtonDownL( TInt /*aEventType*/, |
|
711 |
CFepUiBaseCtrl* /*aCtrl*/, const TDesC& /*aEventData*/ ) |
|
712 |
{ |
|
713 |
||
714 |
} |
|
715 |
||
716 |
// --------------------------------------------------------------------------- |
|
717 |
// handler of button up event. |
|
718 |
// --------------------------------------------------------------------------- |
|
719 |
// |
|
720 |
void CPeninputFingerHwrArLayout::OnCtrlButtonUpL( TInt /*aEventType*/, |
|
721 |
CFepUiBaseCtrl* aCtrl, const TDesC& /*aEventData*/ ) |
|
722 |
{ |
|
723 |
if ( !aCtrl ) |
|
724 |
{ |
|
725 |
return; |
|
726 |
} |
|
727 |
||
728 |
switch ( aCtrl->ControlId() ) |
|
729 |
{ |
|
730 |
case EHwrCtrlIdClose: |
|
731 |
{ |
|
732 |
// Go to standby before closing layout |
|
733 |
ChangeCurStateToStandby(); |
|
734 |
SignalOwner( ESignalLayoutClosed ); |
|
735 |
} |
|
736 |
break; |
|
737 |
case EHwrCtrlIdLanguageOption: |
|
738 |
{ |
|
739 |
SignalOwner( ESignalLaunchOptionMenu ); |
|
740 |
OnDeActivate(); |
|
741 |
} |
|
742 |
break; |
|
743 |
case EHwrCtrlIdSymbolButton: |
|
744 |
{ |
|
745 |
// Go to standby before opening symbol table |
|
746 |
ChangeCurStateToStandby(); |
|
747 |
iHwrWnd->OpenSymbolTable(); |
|
748 |
} |
|
749 |
break; |
|
750 |
case EHwrCtrlId3Page1Btn: |
|
751 |
{ |
|
752 |
iHwrWnd->ShowSymbolPage( 1, EPagePosPageNo ); |
|
753 |
} |
|
754 |
break; |
|
755 |
case EHwrCtrlId3Page2Btn: |
|
756 |
{ |
|
757 |
iHwrWnd->ShowSymbolPage( 2, EPagePosPageNo ); |
|
758 |
} |
|
759 |
break; |
|
760 |
case EHwrCtrlId3Page3Btn: |
|
761 |
{ |
|
762 |
iHwrWnd->ShowSymbolPage( 0, EPagePosPageNo ); |
|
763 |
} |
|
764 |
break; |
|
765 |
case EHwrCtrlId2Page1Btn: |
|
766 |
{ |
|
767 |
iHwrWnd->ShowSymbolPage( 1, EPagePosPageNo ); |
|
768 |
} |
|
769 |
break; |
|
770 |
case EHwrCtrlId2Page2Btn: |
|
771 |
{ |
|
772 |
iHwrWnd->ShowSymbolPage( 0, EPagePosPageNo ); |
|
773 |
} |
|
774 |
break; |
|
775 |
case EHwrCtrlIdBtnEnter: |
|
776 |
{ |
|
777 |
TBuf<1> bufEnter; |
|
778 |
bufEnter.Append( EKeyEnter ); |
|
779 |
SubmitStringToFep( bufEnter ); |
|
780 |
// close the symbol table |
|
781 |
iHwrWnd->CloseSymbolTable(); |
|
782 |
} |
|
783 |
break; |
|
784 |
case EHwrCtrlIdBtnSpace: |
|
785 |
{ |
|
786 |
TBuf<1> bufSpace; |
|
787 |
bufSpace.Append( EKeySpace ); |
|
788 |
SubmitStringToFep( bufSpace ); |
|
789 |
// close the symbol table |
|
790 |
iHwrWnd->CloseSymbolTable(); |
|
791 |
break; |
|
792 |
} |
|
793 |
default: |
|
794 |
break; |
|
795 |
} |
|
796 |
||
797 |
} |
|
798 |
||
799 |
// --------------------------------------------------------------------------- |
|
800 |
// handler of rep-button clicked event. |
|
801 |
// --------------------------------------------------------------------------- |
|
802 |
// |
|
803 |
void CPeninputFingerHwrArLayout::OnRepButtonClickedL( CFepUiBaseCtrl* aCtrl, |
|
804 |
const TDesC& aData ) |
|
805 |
{ |
|
806 |
if ( !aCtrl ) |
|
807 |
{ |
|
808 |
return; |
|
809 |
} |
|
810 |
||
811 |
switch ( aCtrl->ControlId() ) |
|
812 |
{ |
|
813 |
case EHwrCtrlIdArrowRight: |
|
814 |
case EHwrCtrlIdArrowLeft: |
|
815 |
{ |
|
816 |
SignalOwner( ESignalKeyEvent, aData ); |
|
817 |
} |
|
818 |
break; |
|
819 |
default: |
|
820 |
break; |
|
821 |
} |
|
822 |
} |
|
823 |
||
824 |
// --------------------------------------------------------------------------- |
|
825 |
// handler of BACKSPACE button clicked event. |
|
826 |
// --------------------------------------------------------------------------- |
|
827 |
// |
|
828 |
void CPeninputFingerHwrArLayout::OnBackspaceClickedL() |
|
829 |
{ |
|
830 |
iHwrWnd->CancelWriting(); |
|
831 |
if (iHwrWnd->IsCandidateShowup()) |
|
832 |
{ |
|
833 |
// goto standby and clear screen |
|
834 |
if(IsAllowedToSubmitDefaultCandiate()) |
|
835 |
{ |
|
836 |
SignalOwner( ESignalDeleteLastInput, KNullDesC ); |
|
837 |
} |
|
838 |
ChangeCurStateToStandby(); |
|
839 |
} |
|
840 |
else |
|
841 |
{ |
|
842 |
SubmitCharToFep( EKeyBackspace ); |
|
843 |
iStateMgr->HandleEventL( EHwrEventKeyBack, KNullDesC ); |
|
844 |
if(iIsStrokeOfDrawingCharacerStarted) |
|
845 |
{ |
|
846 |
ChangeCurStateToStandby(); |
|
847 |
} |
|
848 |
} |
|
849 |
} |
|
850 |
||
851 |
// --------------------------------------------------------------------------- |
|
852 |
// handler of virtual key down event. |
|
853 |
// --------------------------------------------------------------------------- |
|
854 |
// |
|
855 |
void CPeninputFingerHwrArLayout::OnVirtualKeyDownL( CFepUiBaseCtrl* /*aCtrl*/, |
|
856 |
const TDesC& /*aData*/ ) |
|
857 |
{ |
|
858 |
||
859 |
} |
|
860 |
||
861 |
// --------------------------------------------------------------------------- |
|
862 |
// handler of virtual key up event. |
|
863 |
// --------------------------------------------------------------------------- |
|
864 |
// |
|
865 |
void CPeninputFingerHwrArLayout::OnVirtualKeyUpL( CFepUiBaseCtrl* /*aCtrl*/, |
|
866 |
const TDesC& aData ) |
|
867 |
{ |
|
868 |
const TVirtualKeyEventData* vkdata = NULL; |
|
869 |
const TKeyEvent *keydata = NULL; |
|
870 |
vkdata = reinterpret_cast<const TVirtualKeyEventData*>( aData.Ptr() ); |
|
871 |
keydata = reinterpret_cast<const TKeyEvent*>( aData.Ptr() ); |
|
872 |
||
873 |
if ( vkdata->iKeyEvent.iScanCode == KEmotionKeyMark ) |
|
874 |
{ |
|
875 |
TBuf<KTempBufSize> buf; |
|
876 |
buf.Append( vkdata->iKeyData ); |
|
877 |
SubmitStringToFep( buf ); |
|
878 |
} |
|
879 |
else |
|
880 |
{ |
|
881 |
TBuf<1> bufBck; |
|
882 |
TInt convertedCode; |
|
883 |
TBool converted = EFalse; |
|
884 |
converted = RevertSymbolDirection(keydata->iScanCode,convertedCode); |
|
885 |
bufBck.Append(convertedCode); |
|
886 |
// bufBck.Append(keydata->iScanCode); |
|
887 |
if(converted) |
|
888 |
{ |
|
889 |
SignalOwner(ESignalArabicSCTChar,bufBck); |
|
890 |
} |
|
891 |
else |
|
892 |
{ |
|
893 |
SignalOwner( ESignalKeyEvent, bufBck ); |
|
894 |
} |
|
895 |
} |
|
896 |
||
897 |
// close the symbol table |
|
898 |
iHwrWnd->CloseSymbolTable(); |
|
899 |
} |
|
900 |
||
901 |
// --------------------------------------------------------------------------- |
|
902 |
// handler of candidate list event. |
|
903 |
// --------------------------------------------------------------------------- |
|
904 |
// |
|
905 |
void CPeninputFingerHwrArLayout::OnCandidateSelectedL( CFepUiBaseCtrl* aCtrl, |
|
906 |
const TDesC& aData ) |
|
907 |
{ |
|
908 |
if ( !aCtrl ) |
|
909 |
{ |
|
910 |
return; |
|
911 |
} |
|
912 |
||
913 |
iStateMgr->HandleEventL( EHwrEventCandidateSelected, aData ); |
|
914 |
||
915 |
ChangeCurStateToStandby(); |
|
916 |
} |
|
917 |
||
918 |
||
919 |
// --------------------------------------------------------------------------- |
|
920 |
// clicked event handler of icf. |
|
921 |
// --------------------------------------------------------------------------- |
|
922 |
// |
|
923 |
void CPeninputFingerHwrArLayout::OnIcfClicked() |
|
924 |
{ |
|
925 |
// Go to standby |
|
926 |
ChangeCurStateToStandby(); |
|
927 |
} |
|
928 |
||
929 |
// --------------------------------------------------------------------------- |
|
930 |
// handler of StrokeStarted event. |
|
931 |
// --------------------------------------------------------------------------- |
|
932 |
// |
|
933 |
void CPeninputFingerHwrArLayout::OnHwrStrokeStartedL() |
|
934 |
{ |
|
56
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
935 |
//iCallBack->IssueRequestL(); |
44 | 936 |
iHwrWnd->HideIndicator(); |
937 |
||
938 |
// The default candidate cell is not highlight |
|
939 |
iDataStore->SetHighlight(EFalse); |
|
940 |
||
941 |
// close the candidate list if it's currently showing up |
|
942 |
if(iHwrWnd->IsCandidateShowup()) |
|
943 |
{ |
|
944 |
iHwrWnd->CloseCandidateList(); |
|
945 |
} |
|
946 |
||
947 |
// remember the start writing position. |
|
948 |
iIsStrokeOfDrawingCharacerStarted = ETrue; |
|
949 |
||
950 |
iStateMgr->HandleEventL( EEventHwrStrokeStarted, KNullDesC ); |
|
951 |
} |
|
952 |
||
953 |
void CPeninputFingerHwrArLayout::CallBackL() |
|
954 |
{ |
|
955 |
iHwrWnd->HideIndicator(); |
|
956 |
||
957 |
// The default candidate cell is not highlight |
|
958 |
iDataStore->SetHighlight(EFalse); |
|
959 |
||
960 |
// close the candidate list if it's currently showing up |
|
961 |
if(iHwrWnd->IsCandidateShowup()) |
|
962 |
{ |
|
963 |
iHwrWnd->CloseCandidateList(); |
|
964 |
} |
|
965 |
||
966 |
// remember the start writing position. |
|
967 |
iIsStrokeOfDrawingCharacerStarted = ETrue; |
|
968 |
||
969 |
iStateMgr->HandleEventL( EEventHwrStrokeStarted, KNullDesC ); |
|
970 |
} |
|
971 |
||
972 |
// --------------------------------------------------------------------------- |
|
973 |
// handler of StrokeFinished event. |
|
974 |
// --------------------------------------------------------------------------- |
|
975 |
// |
|
976 |
void CPeninputFingerHwrArLayout::OnHwrStrokeFinishedL() |
|
977 |
{ |
|
978 |
RArray<TPoint> points = iHwrWnd->StrokeList(); |
|
979 |
TPtrC ptr; |
|
980 |
ptr.Set(reinterpret_cast<TText*>(&points), sizeof(&points)); |
|
981 |
iStateMgr->HandleEventL( EEventHwrStrokeFinished, ptr ); |
|
982 |
} |
|
983 |
||
984 |
// --------------------------------------------------------------------------- |
|
985 |
// handler of CharacterFinished event. |
|
986 |
// --------------------------------------------------------------------------- |
|
987 |
// |
|
988 |
void CPeninputFingerHwrArLayout::OnHwrCharacterFinishedL() |
|
989 |
{ |
|
990 |
iIsStrokeOfDrawingCharacerStarted = EFalse; |
|
991 |
||
992 |
RArray<TPoint> points = iHwrWnd->StrokeList(); |
|
993 |
TPtrC ptr; |
|
994 |
ptr.Set( reinterpret_cast<TText*>( &points ), sizeof(&points) ); |
|
995 |
iStateMgr->HandleEventL( EEventHwrCharacterTimerOut, ptr ); |
|
996 |
||
997 |
iHwrWnd->OpenCandidateList(); |
|
998 |
} |
|
999 |
||
1000 |
// --------------------------------------------------------------------------- |
|
1001 |
// get value from repository. |
|
1002 |
// --------------------------------------------------------------------------- |
|
1003 |
// |
|
1004 |
TBool CPeninputFingerHwrArLayout::IsAllowedToSubmitDefaultCandiate() |
|
1005 |
{ |
|
1006 |
return (!iIsEditorMFNE); |
|
1007 |
} |
|
1008 |
||
1009 |
// --------------------------------------------------------------------------- |
|
1010 |
// get value from repository. |
|
1011 |
// --------------------------------------------------------------------------- |
|
1012 |
// |
|
1013 |
TInt CPeninputFingerHwrArLayout::GetNewValue( |
|
1014 |
CAknFepRepositoryWatcher* aWatcher, const TInt aId ) |
|
1015 |
{ |
|
1016 |
TInt newValue = -1; |
|
1017 |
||
1018 |
if ( aWatcher == iGSRepositoryWatcher ) |
|
1019 |
{ |
|
1020 |
iRepositorySetting->Get( aId, newValue ); |
|
1021 |
} |
|
1022 |
||
1023 |
return newValue; |
|
1024 |
} |
|
1025 |
||
1026 |
// --------------------------------------------------------------------------- |
|
1027 |
// get hwr trail color from repository. |
|
1028 |
// --------------------------------------------------------------------------- |
|
1029 |
// |
|
1030 |
TInt CPeninputFingerHwrArLayout::GetPenTrailColor() |
|
1031 |
{ |
|
1032 |
TInt newValue = 0; |
|
1033 |
iRepositorySetting->Get( KSettingsPenColor, newValue ); |
|
1034 |
||
1035 |
if ( !AknPenInputTrailColorUtils::CheckColorInColorTable( newValue ) ) |
|
1036 |
{ |
|
1037 |
return AknPenInputTrailColorUtils::GetTrailColorByTheme(); |
|
1038 |
} |
|
1039 |
return newValue; |
|
1040 |
} |
|
1041 |
||
1042 |
// --------------------------------------------------------------------------- |
|
1043 |
// set hwr writing speed. |
|
1044 |
// --------------------------------------------------------------------------- |
|
1045 |
// |
|
1046 |
void CPeninputFingerHwrArLayout::SetWritingSpeed( const TInt aWritingSpeed ) |
|
1047 |
{ |
|
1048 |
TTimeIntervalMicroSeconds32 speed; |
|
1049 |
switch ( aWritingSpeed ) |
|
1050 |
{ |
|
1051 |
case EWritingSpeedVeryFast: |
|
1052 |
{ |
|
1053 |
speed = EHwrWritingSpeedVeryFast; |
|
1054 |
} |
|
1055 |
break; |
|
1056 |
case EWritingSpeedFast: |
|
1057 |
{ |
|
1058 |
speed = EHwrWritingSpeedFast; |
|
1059 |
} |
|
1060 |
break; |
|
1061 |
case EWritingSpeedNormal: |
|
1062 |
{ |
|
1063 |
speed = EHwrWritingSpeedNormal; |
|
1064 |
} |
|
1065 |
break; |
|
1066 |
case EWritingSpeedSlow: |
|
1067 |
{ |
|
1068 |
speed = EHwrWritingSpeedSlow; |
|
1069 |
} |
|
1070 |
break; |
|
1071 |
case EWritingSpeedVerySlow: |
|
1072 |
{ |
|
1073 |
speed = EHwrWritingSpeedVerySlow; |
|
1074 |
} |
|
1075 |
break; |
|
1076 |
default: |
|
1077 |
{ |
|
1078 |
speed = EHwrWritingSpeedNormal; |
|
1079 |
} |
|
1080 |
break; |
|
1081 |
} |
|
1082 |
||
1083 |
iHwrWnd->SetBoxWritingSpeed( speed ); |
|
1084 |
} |
|
1085 |
||
1086 |
// --------------------------------------------------------------------------- |
|
1087 |
// set hwr writing pen width. |
|
1088 |
// --------------------------------------------------------------------------- |
|
1089 |
// |
|
1090 |
void CPeninputFingerHwrArLayout::SetBoxPenSize( const TSize aPenSize ) |
|
1091 |
{ |
|
1092 |
iHwrWnd->SetBoxPenSize( aPenSize ); |
|
1093 |
} |
|
1094 |
||
1095 |
// --------------------------------------------------------------------------- |
|
1096 |
// set hwr writing pen color. |
|
1097 |
// --------------------------------------------------------------------------- |
|
1098 |
// |
|
1099 |
void CPeninputFingerHwrArLayout::SetBoxPenColor( const TInt aPenColor ) |
|
1100 |
{ |
|
1101 |
iHwrWnd->SetBoxPenColor( aPenColor ); |
|
1102 |
} |
|
1103 |
||
1104 |
// --------------------------------------------------------------------------- |
|
1105 |
// set hwr writing pen color. |
|
1106 |
// --------------------------------------------------------------------------- |
|
1107 |
// |
|
1108 |
void CPeninputFingerHwrArLayout::SetGuideLineOn(TBool aGuideLineOn) |
|
1109 |
{ |
|
1110 |
iHwrWnd->SetGuideLineOn( aGuideLineOn ); |
|
1111 |
} |
|
1112 |
||
1113 |
// --------------------------------------------------------------------------- |
|
1114 |
// change current state manager to standby state. |
|
1115 |
// --------------------------------------------------------------------------- |
|
1116 |
// |
|
1117 |
void CPeninputFingerHwrArLayout::ChangeCurStateToStandby() |
|
1118 |
{ |
|
1119 |
iIsStrokeOfDrawingCharacerStarted = EFalse; |
|
1120 |
iHwrWnd->CancelWriting(); |
|
1121 |
||
1122 |
// close the candidate list if it's currently showing up |
|
1123 |
if(iHwrWnd->IsCandidateShowup()) |
|
1124 |
{ |
|
1125 |
iHwrWnd->CloseCandidateList(); |
|
1126 |
} |
|
1127 |
||
1128 |
// close the symbol table |
|
1129 |
if(iHwrWnd->IsSymbolTableShowingUp()) |
|
1130 |
{ |
|
1131 |
iHwrWnd->CloseSymbolTable(); |
|
1132 |
} |
|
1133 |
||
1134 |
// set the state to be standby |
|
1135 |
iStateMgr->SetState( CPeninputFingerHwrArStateManagerBase::EStateStandBy ); |
|
1136 |
} |
|
1137 |
// --------------------------------------------------------------------------- |
|
1138 |
// handler of NumMapping changed event. |
|
1139 |
// --------------------------------------------------------------------------- |
|
1140 |
// |
|
1141 |
void CPeninputFingerHwrArLayout::OnNumMappingChangedL() |
|
1142 |
{ |
|
1143 |
HBufC* mapping = iDataStore->KeyMappingStringL(); |
|
1144 |
||
1145 |
iHwrWnd->SetNumericMapping( *mapping ); |
|
1146 |
||
1147 |
delete mapping; |
|
1148 |
} |
|
1149 |
// --------------------------------------------------------------------------- |
|
1150 |
// revert special characters direction before sending to editor. |
|
1151 |
// --------------------------------------------------------------------------- |
|
1152 |
// |
|
1153 |
TBool CPeninputFingerHwrArLayout::RevertSymbolDirection(TInt aInChar, TInt & aOutChar) |
|
1154 |
{ |
|
1155 |
TBool converted = ETrue; |
|
1156 |
switch(aInChar) |
|
1157 |
{ |
|
1158 |
case 0x0028: |
|
1159 |
{ |
|
1160 |
aOutChar = 0x0029;//convert ( to ). |
|
1161 |
} |
|
1162 |
break; |
|
1163 |
case 0x0029: |
|
1164 |
{ |
|
1165 |
aOutChar = 0x0028;//convert ) to (. |
|
1166 |
} |
|
1167 |
break; |
|
1168 |
case 0x005B: |
|
1169 |
{ |
|
1170 |
aOutChar = 0x005D;//convert [ to ]. |
|
1171 |
} |
|
1172 |
break; |
|
1173 |
case 0x005D: |
|
1174 |
{ |
|
1175 |
aOutChar = 0x005B;//convert ] to [. |
|
1176 |
} |
|
1177 |
break; |
|
1178 |
case 0x003C: |
|
1179 |
{ |
|
1180 |
aOutChar = 0x003E;//convert < to >. |
|
1181 |
} |
|
1182 |
break; |
|
1183 |
case 0x003E: |
|
1184 |
{ |
|
1185 |
aOutChar = 0x003C;//convert > to <. |
|
1186 |
} |
|
1187 |
break; |
|
1188 |
case 0x007B: |
|
1189 |
{ |
|
1190 |
aOutChar = 0x007D;//convert { to }. |
|
1191 |
} |
|
1192 |
break; |
|
1193 |
case 0x007D: |
|
1194 |
{ |
|
1195 |
aOutChar = 0x007B;//convert } to {. |
|
1196 |
} |
|
1197 |
break; |
|
1198 |
default: |
|
1199 |
aOutChar = aInChar; |
|
1200 |
converted = EFalse; |
|
1201 |
break; |
|
1202 |
} |
|
1203 |
return converted; |
|
1204 |
} |
|
1205 |
||
1206 |
//End of file |