44
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2005 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 of hwr window class
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// System includes
|
|
20 |
#include <peninputhwrwindow.rsg>
|
|
21 |
#include <peninputhwrwindowconfiginfo_01.rsg>
|
|
22 |
#include <aknfeppeninputenums.h>
|
|
23 |
#include <peninputinputcontextfield.h>
|
|
24 |
#include <peninputpluginutils.h>
|
|
25 |
#include <peninputcommonlayout.h>
|
|
26 |
#include <peninputeventbutton.h>
|
|
27 |
#include <peninputrepeatbutton.h>
|
|
28 |
#include <peninputlayouthwrwnd.h>
|
|
29 |
#include <peninputrangebar.h>
|
|
30 |
#include <peninputdataconverter.h>
|
|
31 |
#include <peninputdataprovider.h>
|
|
32 |
#include <peninputclientlayoutinfo.h>
|
|
33 |
#include <peninputdropdownlist.h>
|
|
34 |
#include <AknIconUtils.h>
|
|
35 |
#include <AknLayoutDef.h>
|
|
36 |
#include <AknUtils.h>
|
|
37 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
38 |
#include <AknsUtils.h>
|
|
39 |
#include <peninputlayoutchoicelist.h>
|
|
40 |
#include <AknFepGlobalEnums.h>
|
|
41 |
#include <peninputlayoutinputmodechoice.h>
|
|
42 |
#include <peninputlayoutmultilineicf.h>
|
|
43 |
#include <coemain.h>
|
|
44 |
#include <peninputdragbutton.h>
|
|
45 |
#include <peninputrepeatbutton.h>
|
|
46 |
#include <peninputdataconverter.h>
|
|
47 |
#include <peninputpluginutils.h>
|
|
48 |
|
|
49 |
// User includes
|
|
50 |
#include "peninputlayoutchoicelist.h"
|
|
51 |
#include "peninputhwrarabicwindow.h"
|
|
52 |
#include "peninputhwrarabicdatamgr.h"
|
|
53 |
#include "peninputhwrarabic.hrh"
|
|
54 |
#include "peninputhwrarabicengine.h"
|
|
55 |
//#include "peninputhwrevent.h"
|
|
56 |
#include "peninputhwrarabiclayout.h"
|
|
57 |
// Constants
|
|
58 |
_LIT( KHwrWindowResourceFile,
|
|
59 |
"z:\\resource\\plugins\\peninputhwrwindow.RSC" );
|
|
60 |
_LIT( KConfigurationResourceFile,
|
|
61 |
"z:\\resource\\plugins\\peninputhwrwindowconfiginfo_" );
|
|
62 |
_LIT( KResourceFileExtName, ".RSC" );
|
|
63 |
|
|
64 |
_LIT(KStandardPuncExclamatoryPoint, "\x0021");
|
|
65 |
_LIT(KStandardPuncDotPoint, "\x002E");
|
|
66 |
_LIT(KArabicPuncComma, "\x060C");
|
|
67 |
_LIT(KArabicPuncSemicolon, "\x061B");
|
|
68 |
_LIT(KArabicPuncQuestion, "\x061F");
|
|
69 |
_LIT(KArabicPuncWaw, "\x0648");
|
|
70 |
|
|
71 |
const TInt KWrittingFactor = 0;
|
|
72 |
const TInt KNormalFactor = 26;
|
|
73 |
|
|
74 |
const TInt KWriteBoxFrameBackColorMajor = EAknsMajorSkin;
|
|
75 |
const TInt KWriteBoxFrameBackColorGrp = EAknsMinorQsnOtherColors;
|
|
76 |
const TInt KWriteBoxFrameBackColorIdx = EAknsCIQsnOtherColorsCG9;
|
|
77 |
const TUint32 KDefaultWriteBoxFrameColor = 0x000000;
|
|
78 |
const TUint32 KDefaultWriteBoxBackColor = 0xffffff;
|
|
79 |
|
|
80 |
const TInt KPeninputHwrWndInvalidIndex = -1;
|
|
81 |
// ======== MEMBER FUNCTIONS ========
|
|
82 |
|
|
83 |
// --------------------------------------------------------------------------
|
|
84 |
// CPeninputHwrBxAbWnd::CPeninputHwrBxAbWnd
|
|
85 |
// (other items were commented in a header)
|
|
86 |
// --------------------------------------------------------------------------
|
|
87 |
//
|
|
88 |
CPeninputHwrBxAbWnd::CPeninputHwrBxAbWnd(
|
|
89 |
CFepUiLayout* aUiLayout, MPeninputLayoutContext* aLayoutContext )
|
|
90 |
: CPeninputLayoutWindow( aUiLayout, aLayoutContext ),
|
|
91 |
iNormalTransFactor(KNormalFactor),
|
|
92 |
iWriteTransFactor(KWrittingFactor),
|
|
93 |
iGuideLineSet(EFalse),
|
|
94 |
iBackspaceMirrored(EFalse)
|
|
95 |
{
|
|
96 |
}
|
|
97 |
|
|
98 |
// --------------------------------------------------------------------------
|
|
99 |
// CPeninputHwrBxAbWnd::NewL
|
|
100 |
// (other items were commented in a header)
|
|
101 |
// --------------------------------------------------------------------------
|
|
102 |
//
|
|
103 |
CPeninputHwrBxAbWnd* CPeninputHwrBxAbWnd::NewL(
|
|
104 |
CFepUiLayout* aUiLayout, MPeninputLayoutContext* aLayoutContext )
|
|
105 |
{
|
|
106 |
CPeninputHwrBxAbWnd* self =
|
|
107 |
new ( ELeave ) CPeninputHwrBxAbWnd( aUiLayout, aLayoutContext );
|
|
108 |
CleanupStack::PushL( self );
|
|
109 |
self->ConstructL();
|
|
110 |
CleanupStack::Pop( self );
|
|
111 |
|
|
112 |
return self;
|
|
113 |
}
|
|
114 |
|
|
115 |
// --------------------------------------------------------------------------
|
|
116 |
// CPeninputHwrBxAbWnd::~CPeninputHwrBxAbWnd
|
|
117 |
// (other items were commented in a header)
|
|
118 |
// --------------------------------------------------------------------------
|
|
119 |
//
|
|
120 |
CPeninputHwrBxAbWnd::~CPeninputHwrBxAbWnd()
|
|
121 |
{
|
|
122 |
for ( TInt i = 0; i < iRecogResult.Count(); i++ )
|
|
123 |
{
|
|
124 |
delete iRecogResult[i];
|
|
125 |
}
|
|
126 |
iRecogResult.Close();
|
|
127 |
iStrokeArray.Close();
|
|
128 |
delete iLastResult;
|
|
129 |
delete iBmpRotator;
|
|
130 |
}
|
|
131 |
|
|
132 |
// --------------------------------------------------------------------------
|
|
133 |
// CPeninputHwrBxAbWnd::ConstructL
|
|
134 |
// (other items were commented in a header)
|
|
135 |
// --------------------------------------------------------------------------
|
|
136 |
//
|
|
137 |
void CPeninputHwrBxAbWnd::ConstructL()
|
|
138 |
{
|
|
139 |
iBmpRotator = CPeninputSyncBitmapRotator::NewL();
|
|
140 |
CPeninputLayoutWindow::ConstructL();
|
|
141 |
CPeninputHwrBxAbDataMgr::THandWritingPenData* penData =
|
|
142 |
( CPeninputHwrBxAbDataMgr::THandWritingPenData* )
|
|
143 |
iLayoutContext->RequestData( EPeninputDataTypeReserve_1 );
|
|
144 |
|
|
145 |
if ( ( penData ) && ( iHwBox ) )
|
|
146 |
{
|
|
147 |
iHwBox->SetCharacterDelay( penData->iWritingSpeed );
|
|
148 |
iHwBox->SetFadingSpeed(penData->iFadingSpeed);
|
|
149 |
#ifdef _NOT_USING_DECUMA_MCR_
|
|
150 |
// similar as S90
|
|
151 |
|
|
152 |
iHwBox->SetStrokeDelay( 90000 );
|
|
153 |
|
|
154 |
#endif
|
|
155 |
|
|
156 |
iHwBox->SetPenSize( penData->iPenSize );
|
|
157 |
iHwBox->SetPenColor( penData->iPenColor );
|
|
158 |
iHwBox->SetWndTransparencyFactor(iNormalTransFactor);
|
|
159 |
}
|
|
160 |
}
|
|
161 |
|
|
162 |
// --------------------------------------------------------------------------
|
|
163 |
// CPeninputHwrBxAbWnd::HandleControlEvent
|
|
164 |
// (other items were commented in a header)
|
|
165 |
// --------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
void CPeninputHwrBxAbWnd::HandleControlEvent( TInt aEventType,
|
|
168 |
CFepUiBaseCtrl* aCtrl,
|
|
169 |
const TDesC& aEventData )
|
|
170 |
{
|
|
171 |
// Call this function in base class
|
|
172 |
CPeninputLayoutWindow::HandleControlEvent( aEventType,
|
|
173 |
aCtrl,
|
|
174 |
aEventData );
|
|
175 |
|
|
176 |
TInt* data = ( TInt* ) aEventData.Ptr();
|
|
177 |
|
|
178 |
switch ( aEventType )
|
|
179 |
{
|
|
180 |
case EPeninputLayoutHwrEventPenColorChange:
|
|
181 |
case EPeninputLayoutHwrEventPenSizeChange:
|
|
182 |
case EPeninputLayoutHwrEventWritingSpeedChange:
|
|
183 |
{
|
|
184 |
CPeninputHwrBxAbDataMgr::THandWritingPenData* penData =
|
|
185 |
( CPeninputHwrBxAbDataMgr::THandWritingPenData* )
|
|
186 |
iLayoutContext->RequestData( EPeninputDataTypeReserve_1 );
|
|
187 |
|
|
188 |
iHwBox->SetCharacterDelay( penData->iWritingSpeed );
|
|
189 |
iHwBox->SetFadingSpeed(penData->iFadingSpeed);
|
|
190 |
|
|
191 |
#ifdef _NOT_USING_DECUMA_MCR_
|
|
192 |
|
|
193 |
// similar as S90
|
|
194 |
iHwBox->SetStrokeDelay( 90000 );
|
|
195 |
|
|
196 |
#endif
|
|
197 |
|
|
198 |
iHwBox->SetPenSize( penData->iPenSize );
|
|
199 |
iHwBox->SetPenColor( penData->iPenColor );
|
|
200 |
}
|
|
201 |
break;
|
|
202 |
case EPeninputLayoutHwrEventGuideLineChanged:
|
|
203 |
{
|
|
204 |
CPeninputHwrBxAbDataMgr::THandWritingPenData* penData =
|
|
205 |
( CPeninputHwrBxAbDataMgr::THandWritingPenData* )
|
|
206 |
iLayoutContext->RequestData( EPeninputDataTypeReserve_1 );
|
|
207 |
|
|
208 |
iHwBox->HideGuideLine( penData->iGuideLineOn == 0 ? EFalse : ETrue );
|
|
209 |
iHwBox->RefreshUI();
|
|
210 |
}
|
|
211 |
break;
|
|
212 |
case EEventHwrStrokeCanceled:
|
|
213 |
{
|
|
214 |
OnStrokeCanceled();
|
|
215 |
}
|
|
216 |
break;
|
|
217 |
case EPeninputLayoutEventCloseWindow:
|
|
218 |
{
|
|
219 |
iStrokeArray.Reset();
|
|
220 |
iHwBox->CapturePointer(EFalse);
|
|
221 |
iHwBox->CancelCharWriting();
|
|
222 |
}
|
|
223 |
break;
|
|
224 |
case EEventChoiceSelected:
|
|
225 |
{
|
|
226 |
CFepLayoutChoiceList::SEvent* event =
|
|
227 |
( CFepLayoutChoiceList::SEvent* ) aEventData.Ptr();
|
|
228 |
|
|
229 |
if ( event->iIndex != KPeninputHwrWndInvalidIndex )
|
|
230 |
{
|
|
231 |
if (aCtrl->ControlId() == EPeninutWindowCtrlIdSwitcherPopupWindow)
|
|
232 |
{
|
|
233 |
if (EPluginInputModeHwr != event->iCommand)
|
|
234 |
{
|
|
235 |
TBool switchByMode = ETrue;
|
|
236 |
TInt mode = event->iCommand;
|
|
237 |
|
|
238 |
TBuf<8> buf;
|
|
239 |
buf.Append(reinterpret_cast<TText*>(&switchByMode),
|
|
240 |
sizeof(TBool)/sizeof(TText));
|
|
241 |
buf.Append(reinterpret_cast<TText*>(&mode), sizeof(TInt)/sizeof(TText));
|
|
242 |
UiLayout()->SignalOwner(ESignalLayoutUIChanged,buf);
|
|
243 |
}
|
|
244 |
}
|
|
245 |
}
|
|
246 |
else
|
|
247 |
{// handle dropdownlist when user tapped switch inputmethods popup window without selecting other inputmethods.
|
|
248 |
TInt dataType = CPeninputDataConverter::AnyToInt(iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ));
|
|
249 |
if (dataType == ERangeNative)
|
|
250 |
{
|
|
251 |
ResetAndShowDropdownList();
|
|
252 |
}
|
|
253 |
else
|
|
254 |
{
|
|
255 |
ClearAndCloseDropdownList();
|
|
256 |
}
|
|
257 |
}
|
|
258 |
}
|
|
259 |
break;
|
|
260 |
case EPeninputLayoutEventToVkb:
|
|
261 |
{
|
|
262 |
iHwBox->CancelCharWriting();
|
|
263 |
TInt curRange = CPeninputDataConverter::AnyToInt(iLayoutContext->RequestData(EPeninputDataTypeCurrentRange) );
|
|
264 |
if (curRange == ERangeNative)
|
|
265 |
{
|
|
266 |
iDropdownList->ResetAndClear(CFepCtrlDropdownList::EListExpandableMultiRowWithoutIcon );
|
|
267 |
}
|
|
268 |
PopupSwitchWindow();
|
|
269 |
}
|
|
270 |
break;
|
|
271 |
case EPeninputLayoutEventRange:
|
|
272 |
{
|
|
273 |
iHwBox->CancelCharWriting();
|
|
274 |
ClearAndCloseDropdownList();
|
|
275 |
SizeChanged(ETrue);
|
|
276 |
}
|
|
277 |
break;
|
|
278 |
case EPeninputLayoutEventBack:
|
|
279 |
{
|
|
280 |
HandleBackspaceKeyEvent();
|
|
281 |
}
|
|
282 |
break;
|
|
283 |
|
|
284 |
default:
|
|
285 |
break;
|
|
286 |
}
|
|
287 |
}
|
|
288 |
|
|
289 |
// --------------------------------------------------------------------------
|
|
290 |
// CPeninputHwrBxAbWnd::GetWindowConfigResId
|
|
291 |
// (other items were commented in a header)
|
|
292 |
// --------------------------------------------------------------------------
|
|
293 |
//
|
|
294 |
TInt CPeninputHwrBxAbWnd::GetWindowConfigResId()
|
|
295 |
{
|
|
296 |
return R_PENINPUT_LAYOUT_CONFIG_INFO;
|
|
297 |
}
|
|
298 |
|
|
299 |
// --------------------------------------------------------------------------
|
|
300 |
// CPeninputHwrBxAbWnd::GetWindowResId
|
|
301 |
// (other items were commented in a header)
|
|
302 |
// --------------------------------------------------------------------------
|
|
303 |
//
|
|
304 |
TInt CPeninputHwrBxAbWnd::GetWindowResId()
|
|
305 |
{
|
|
306 |
return R_PENINPUT_LAYOUT_HWR_WINDOW;
|
|
307 |
}
|
|
308 |
|
|
309 |
// --------------------------------------------------------------------------
|
|
310 |
// CPeninputHwrBxAbWnd::GetWindowConfigResFileName
|
|
311 |
// (other items were commented in a header)
|
|
312 |
// --------------------------------------------------------------------------
|
|
313 |
//
|
|
314 |
const TDesC& CPeninputHwrBxAbWnd::GetWindowConfigResFileName(
|
|
315 |
TInt aLangID )
|
|
316 |
{
|
|
317 |
if ( aLangID <= 0 )
|
|
318 |
{
|
|
319 |
return KNullDesC;
|
|
320 |
}
|
|
321 |
|
|
322 |
iResourceFilename.Zero();
|
|
323 |
iResourceFilename = KConfigurationResourceFile();
|
|
324 |
|
|
325 |
if ( aLangID < 10 )
|
|
326 |
{
|
|
327 |
iResourceFilename.AppendNum( 0 );
|
|
328 |
iResourceFilename.AppendNum( aLangID );
|
|
329 |
}
|
|
330 |
else
|
|
331 |
{
|
|
332 |
iResourceFilename.AppendNum( aLangID );
|
|
333 |
}
|
|
334 |
iResourceFilename.Append( KResourceFileExtName );
|
|
335 |
|
|
336 |
return iResourceFilename;
|
|
337 |
}
|
|
338 |
|
|
339 |
// --------------------------------------------------------------------------
|
|
340 |
// CPeninputHwrBxAbWnd::GetWindowResFileName
|
|
341 |
// (other items were commented in a header)
|
|
342 |
// --------------------------------------------------------------------------
|
|
343 |
//
|
|
344 |
const TDesC& CPeninputHwrBxAbWnd::GetWindowResFileName()
|
|
345 |
{
|
|
346 |
return KHwrWindowResourceFile();
|
|
347 |
}
|
|
348 |
|
|
349 |
// --------------------------------------------------------------------------
|
|
350 |
// CPeninputHwrBxAbWnd::CreateAllControlsL
|
|
351 |
// (other items were commented in a header)
|
|
352 |
// --------------------------------------------------------------------------
|
|
353 |
//
|
|
354 |
void CPeninputHwrBxAbWnd::CreateAllControlsL()
|
|
355 |
{
|
|
356 |
// Hwr box
|
|
357 |
AddHwBoxL();
|
|
358 |
|
|
359 |
// Range bar
|
|
360 |
AddRangeBarL();
|
|
361 |
|
|
362 |
// Language switch button
|
|
363 |
iLangSwitchBtn = AddButtonL( EPeninutWindowCtrlIdInputLangSwitcherBtn,
|
|
364 |
EPeninputLayoutEventSwitchLanguage,
|
|
365 |
R_PENINPUT_LAYOUT_HWR_SWITCH );
|
|
366 |
SetSwitchBtnFont(*iLangSwitchBtn);
|
|
367 |
SetSwitchBtnTextColor(*iLangSwitchBtn);
|
|
368 |
|
|
369 |
// Switch to vkb button
|
|
370 |
AddButtonL( EPeninutWindowCtrlIdSwitchToVkbBtn,
|
|
371 |
EPeninputLayoutEventToVkb,
|
|
372 |
R_PENINPUT_LAYOUT_HWR_VKB );
|
|
373 |
|
|
374 |
iModeSwitchChoice = CPeninputLayoutInputmodelChoice::NewL( UiLayout(),
|
|
375 |
EPeninutWindowCtrlIdSwitcherPopupWindow, EPluginInputModeHwr);
|
|
376 |
iModeSwitchChoice->SetListSkinID( KAknsIIDQsnFrList, KAknsIIDQsnFrPopupSub );
|
|
377 |
AddControlL( iModeSwitchChoice );
|
|
378 |
iModeSwitchChoice->AddEventObserver( UiLayout() );
|
|
379 |
|
|
380 |
|
|
381 |
//add dropdown list to client pane.
|
|
382 |
TPixelsTwipsAndRotation ptSize;
|
|
383 |
CCoeEnv* coeEnv = CCoeEnv::Static();
|
|
384 |
coeEnv->ScreenDevice()->GetDefaultScreenSizeAndRotation(ptSize);
|
|
385 |
|
|
386 |
TBool boxWndLandscape;
|
|
387 |
|
|
388 |
//set proper screen style for box window
|
|
389 |
if (ptSize.iPixelSize.iWidth < ptSize.iPixelSize.iHeight)
|
|
390 |
{
|
|
391 |
// protrait screen
|
|
392 |
boxWndLandscape = EFalse;
|
|
393 |
}
|
|
394 |
else
|
|
395 |
{
|
|
396 |
// landscape screen
|
|
397 |
boxWndLandscape = ETrue;
|
|
398 |
}
|
|
399 |
AddDropdownListL(boxWndLandscape);
|
|
400 |
// TRect rect = iHwBox->Rect();
|
|
401 |
// rect.iTl.iY = rect.iTl.iY + 2*iUnitHeight;
|
|
402 |
//
|
|
403 |
// iHwBox->SetRect(rect);
|
|
404 |
|
|
405 |
if( iCtrlPool != NULL )
|
|
406 |
{
|
|
407 |
for ( TInt i = 0; i < iCtrlPool->ControlCount(); i++ )
|
|
408 |
{
|
|
409 |
if ( iCtrlPool->ControlByIndex( i ) )
|
|
410 |
{
|
|
411 |
iCtrlPool->ControlByIndex( i )->AddEventObserver( UiLayout() );
|
|
412 |
}
|
|
413 |
}
|
|
414 |
}
|
|
415 |
}
|
|
416 |
|
|
417 |
// --------------------------------------------------------------------------
|
|
418 |
// CPeninputHwrBxAbWnd::ChangeUnitSize
|
|
419 |
// (other items were commented in a header)
|
|
420 |
// --------------------------------------------------------------------------
|
|
421 |
//
|
|
422 |
const TRect CPeninputHwrBxAbWnd::ChangeUnitSize()
|
|
423 |
{
|
|
424 |
if (CPeninputDataConverter::AnyToInt(
|
|
425 |
iLayoutContext->RequestData(EAkninputDataTypeSizeChanging)) ||
|
|
426 |
!(CPeninputDataConverter::AnyToInt(
|
|
427 |
iLayoutContext->RequestData(EAkninputDataTypeUnitSizeSet))))
|
|
428 |
{
|
|
429 |
// if size changing, or unitwidth, unitheight has not been set yet
|
|
430 |
TAknWindowLineLayout appWnd;
|
|
431 |
TAknWindowLineLayout mainPane;
|
|
432 |
TAknWindowLineLayout wndLayout;
|
|
433 |
TAknWindowLineLayout unitLayout;
|
|
434 |
TAknLayoutRect mainPaneRect;
|
|
435 |
TAknLayoutRect wndRect;
|
|
436 |
TAknLayoutRect unitRect;
|
|
437 |
|
|
438 |
// Get hwr window layout
|
|
439 |
appWnd = AknLayoutScalable_Avkon::application_window( 0 ).LayoutLine();
|
|
440 |
|
|
441 |
if (appWnd.iW > appWnd.iH)
|
|
442 |
{
|
|
443 |
// landscape
|
|
444 |
mainPane = AknLayoutScalable_Avkon::main_pane(4).LayoutLine();
|
|
445 |
wndLayout = AknLayoutScalable_Avkon::popup_fep_hwr_window(2).LayoutLine();
|
|
446 |
}
|
|
447 |
else
|
|
448 |
{
|
|
449 |
// portrait
|
|
450 |
mainPane = AknLayoutScalable_Avkon::main_pane(1).LayoutLine();
|
|
451 |
wndLayout = AknLayoutScalable_Avkon::popup_fep_hwr_window(0).LayoutLine();
|
|
452 |
}
|
|
453 |
|
|
454 |
mainPaneRect.LayoutRect(appWnd.Rect(), mainPane);
|
|
455 |
wndRect.LayoutRect(mainPaneRect.Rect(), wndLayout);
|
|
456 |
|
|
457 |
unitLayout = AknLayoutScalable_Avkon::fep_hwr_aid_pane(1).LayoutLine();
|
|
458 |
unitRect.LayoutRect(wndRect.Rect(), unitLayout);
|
|
459 |
|
|
460 |
iHwrWndRect = TRect(0,
|
|
461 |
0,
|
|
462 |
wndRect.Rect().Width(),
|
|
463 |
wndRect.Rect().Height());
|
|
464 |
|
|
465 |
TInt unitWidth = unitRect.Rect().Width();
|
|
466 |
TInt unitHeight = unitRect.Rect().Height();
|
|
467 |
|
|
468 |
iLayoutContext->SetData(EPeninputDataTypeUnitWidth, &unitWidth);
|
|
469 |
iLayoutContext->SetData(EPeninputDataTypeUnitHeight, &unitHeight);
|
|
470 |
}
|
|
471 |
|
|
472 |
return iHwrWndRect;
|
|
473 |
}
|
|
474 |
|
|
475 |
// --------------------------------------------------------------------------
|
|
476 |
// CPeninputHwrBxAbWnd::ChangeClientSize
|
|
477 |
// (other items were commented in a header)
|
|
478 |
// --------------------------------------------------------------------------
|
|
479 |
//
|
|
480 |
void CPeninputHwrBxAbWnd::ChangeClientSize()
|
|
481 |
{
|
|
482 |
TInt unitWidth = CPeninputDataConverter::AnyToInt
|
|
483 |
( iLayoutContext->RequestData( EPeninputDataTypeUnitWidth ) );
|
|
484 |
TInt unitHeight = CPeninputDataConverter::AnyToInt
|
|
485 |
( iLayoutContext->RequestData( EPeninputDataTypeUnitHeight ) );
|
|
486 |
|
|
487 |
// Modify language switch button font
|
|
488 |
SetSwitchBtnFont(*iLangSwitchBtn);
|
|
489 |
|
|
490 |
TInt clientLayoutId = CPeninputDataConverter::AnyToInt
|
|
491 |
( iLayoutContext->RequestData( EPeninputDataTypeClientLayout ) );
|
|
492 |
CPeninputClientLayoutInfo* clientLayout =
|
|
493 |
ConfigInfo()->FindClientLayoutInfo( clientLayoutId );
|
|
494 |
|
|
495 |
if ( clientLayout )
|
|
496 |
{
|
|
497 |
// Change self rect
|
|
498 |
/*TInt width = clientLayout->Columns() * unitWidth;
|
|
499 |
TInt height = clientLayout->Rows() * unitHeight;
|
|
500 |
TRect rect = TRect( ClientPane()->Rect().iTl,
|
|
501 |
TSize( width, height ) );
|
|
502 |
|
|
503 |
ClientPane()->SetRect( rect );*/
|
|
504 |
// Change the postion and size of controls in current layout
|
|
505 |
ReorganizeControls( clientLayout->LayoutID() );
|
|
506 |
}
|
|
507 |
//mirror backspace arrow
|
|
508 |
TRAP_IGNORE(MirrorBackspaceButtonResL());
|
|
509 |
}
|
|
510 |
|
|
511 |
// --------------------------------------------------------------------------
|
|
512 |
// CPeninputHwrBxAbWnd::ReorganizeControls
|
|
513 |
// (other items were commented in a header)
|
|
514 |
// --------------------------------------------------------------------------
|
|
515 |
//
|
|
516 |
void CPeninputHwrBxAbWnd::ReorganizeControls( TInt aClientLayoutId, TBool /*aNeedReset*/ )
|
|
517 |
{
|
|
518 |
TInt unitWidth = CPeninputDataConverter::AnyToInt
|
|
519 |
( iLayoutContext->RequestData( EPeninputDataTypeUnitWidth ) );
|
|
520 |
TInt unitHeight = CPeninputDataConverter::AnyToInt
|
|
521 |
( iLayoutContext->RequestData( EPeninputDataTypeUnitHeight ) );
|
|
522 |
|
|
523 |
CPeninputClientLayoutInfo* clientLayout =
|
|
524 |
ConfigInfo()->FindClientLayoutInfo( aClientLayoutId );
|
|
525 |
|
|
526 |
// First remove all controls in the client pane, but don't delete them
|
|
527 |
( const_cast<RPointerArray<CFepUiBaseCtrl>&>
|
|
528 |
( ClientPane()->ControlList() ) ).Reset();
|
|
529 |
|
|
530 |
// Set case sensitive for the engine
|
|
531 |
CPeninputHwrBxAbDataMgr::THandWritingPenData* penData =
|
|
532 |
( CPeninputHwrBxAbDataMgr::THandWritingPenData* )
|
|
533 |
iLayoutContext->RequestData( EPeninputDataTypeReserve_1 );
|
|
534 |
|
|
535 |
penData->iRecognizer->SetCaseSensitive( ConfigInfo()->CaseSensitive() );
|
|
536 |
|
|
537 |
|
|
538 |
//reset window rect, titlebar rect, client rect
|
|
539 |
TSize szClient( clientLayout->Columns() * unitWidth,
|
|
540 |
clientLayout->Rows() * unitHeight );
|
|
541 |
|
|
542 |
TSize szWnd( clientLayout->Columns() * unitWidth,
|
|
543 |
clientLayout->Rows() * unitHeight + unitHeight );
|
|
544 |
|
|
545 |
TSize szTitle ( clientLayout->Columns() * unitWidth, unitHeight );
|
|
546 |
|
|
547 |
SetWindowRect( TRect(Rect().iTl, szWnd) );
|
|
548 |
|
|
549 |
//setwindowrect may change automactially for shadow or other things
|
|
550 |
TPoint ptTopLeft = Rect().iTl;
|
|
551 |
|
|
552 |
TitleBar()->SetRect( TRect(ptTopLeft, szTitle ) );
|
|
553 |
ClientPane()->SetRect( TRect(ptTopLeft + TPoint(0, unitHeight),
|
|
554 |
szClient) );
|
|
555 |
|
|
556 |
// Get control list from client layout
|
|
557 |
RPointerArray<CPeninputControlInfo>& controlList =
|
|
558 |
clientLayout->ControlInfoList();
|
|
559 |
const TInt count = controlList.Count();
|
|
560 |
TInt controlID = 0;
|
|
561 |
TInt cols = 0;
|
|
562 |
TInt rows = 0;
|
|
563 |
CFepUiBaseCtrl* ctrl = NULL;
|
|
564 |
|
|
565 |
//controls are based on client pane
|
|
566 |
TPoint point = ptTopLeft + TPoint(0, unitHeight);
|
|
567 |
|
|
568 |
for ( TInt i = 0; i < count; i++ )
|
|
569 |
{
|
|
570 |
controlID = controlList[i]->ControlID();
|
|
571 |
ctrl = iCtrlPool->Control( controlID );
|
|
572 |
|
|
573 |
if ( ctrl )
|
|
574 |
{
|
|
575 |
TRect rect;
|
|
576 |
rect.iTl = point
|
|
577 |
+ TPoint( controlList[i]->BeginColumn() * unitWidth,
|
|
578 |
controlList[i]->BeginRow() * unitHeight );
|
|
579 |
cols = controlList[i]->EndColumn()
|
|
580 |
- controlList[i]->BeginColumn();
|
|
581 |
rows = controlList[i]->EndRow()
|
|
582 |
- controlList[i]->BeginRow();
|
|
583 |
rect.SetSize( TSize( cols * unitWidth, rows * unitHeight ) );
|
|
584 |
AddNotOwnedControl( ctrl );
|
|
585 |
|
|
586 |
if ( ( ctrl->ControlType() | ECtrlButton ) == ECtrlButton )
|
|
587 |
{
|
|
588 |
TRect innerRect;
|
|
589 |
AknPenImageUtils::CalculateGraphicRect( rect, innerRect );
|
|
590 |
( static_cast<CAknFepCtrlCommonButton*> ( ctrl ) )->SizeChanged
|
|
591 |
( rect, innerRect, ETrue );
|
|
592 |
}
|
|
593 |
else if ( ctrl->ControlId() == EPeninutWindowCtrlIdRangeBar )
|
|
594 |
{
|
|
595 |
rect = TRect( rect.iTl, TSize( unitWidth, unitHeight ) );
|
|
596 |
( static_cast<CAknFepCtrlRangeBar*> ( ctrl ) )->SizeChanged( rect );
|
|
597 |
}
|
|
598 |
else if ( ctrl->ControlId() == EPeninutWindowCtrlIdHwrBox )
|
|
599 |
{
|
|
600 |
TInt language = penData->iRecognizer->GetLanguage();
|
|
601 |
TInt curRange = CPeninputDataConverter::AnyToInt( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) );
|
|
602 |
if (language == ELangArabic && curRange
|
|
603 |
> ERangeInvalid)
|
|
604 |
{
|
|
605 |
if (language == ELangArabic && curRange
|
|
606 |
== ERangeNative)
|
|
607 |
{
|
|
608 |
iHwBox->SetRect(rect);
|
|
609 |
DrawGuideLine();
|
|
610 |
}
|
|
611 |
else
|
|
612 |
{
|
|
613 |
//recalculate rect size to include dropdown list area.
|
|
614 |
rect.iTl = point + TPoint(
|
|
615 |
controlList[i]->BeginColumn()
|
|
616 |
* unitWidth,
|
|
617 |
(controlList[i]->BeginRow() - 2)
|
|
618 |
* unitHeight);
|
|
619 |
cols = controlList[i]->EndColumn()
|
|
620 |
- controlList[i]->BeginColumn();
|
|
621 |
rows = controlList[i]->EndRow()
|
|
622 |
- controlList[i]->BeginRow() + 2;
|
|
623 |
rect.SetSize(TSize(cols * unitWidth, rows
|
|
624 |
* unitHeight) );
|
|
625 |
iHwBox->SetRect(rect);
|
|
626 |
DrawGuideLine();
|
|
627 |
}
|
|
628 |
}
|
|
629 |
else
|
|
630 |
{
|
|
631 |
iHwBox->SetRect(rect);
|
|
632 |
DrawGuideLine();
|
|
633 |
}
|
|
634 |
}
|
|
635 |
else if(ctrl->ControlId() == EPentinputHwrCandidateList)
|
|
636 |
{
|
|
637 |
TInt language = penData->iRecognizer->GetLanguage();
|
|
638 |
TInt curRange = CPeninputDataConverter::AnyToInt( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) );
|
|
639 |
if(language == ELangArabic && curRange > ERangeInvalid)
|
|
640 |
{
|
|
641 |
if(language == ELangArabic && curRange == ERangeNative)
|
|
642 |
{
|
|
643 |
iDropdownList->SetRect(rect);
|
|
644 |
iDropdownList->Hide(EFalse);
|
|
645 |
}
|
|
646 |
else
|
|
647 |
{
|
|
648 |
iDropdownList->SetRect(TRect(0,0,0,0));
|
|
649 |
}
|
|
650 |
}
|
|
651 |
else
|
|
652 |
{
|
|
653 |
iDropdownList->SetRect(rect);
|
|
654 |
iDropdownList->Hide(EFalse);
|
|
655 |
}
|
|
656 |
}
|
|
657 |
}
|
|
658 |
}
|
|
659 |
}
|
|
660 |
|
|
661 |
// --------------------------------------------------------------------------
|
|
662 |
// CPeninputHwrBxAbWnd::CalculateGuideLinePos
|
|
663 |
// (other items were commented in a header)
|
|
664 |
// --------------------------------------------------------------------------
|
|
665 |
//
|
|
666 |
void CPeninputHwrBxAbWnd::CalculateGuideLinePos()
|
|
667 |
{
|
|
668 |
TRect rect = iHwBox->Rect();
|
|
669 |
TInt leftrightmargin = rect.Size().iWidth / 10;
|
|
670 |
|
|
671 |
TSize size;
|
|
672 |
size.iHeight = rect.iBr.iY - rect.iTl.iY;
|
|
673 |
size.iWidth = rect.iBr.iX - rect.iTl.iX;
|
|
674 |
iLayoutContext->SetData( EAkninputDataTypeInputArea, &size );
|
|
675 |
|
|
676 |
TInt bottommargin = *(TInt*)iLayoutContext->RequestData( EAkninputDataTypeGuideLineBottom );
|
|
677 |
TInt topmargin = *(TInt*)iLayoutContext->RequestData( EAkninputDataTypeGuideLineTop );
|
|
678 |
|
|
679 |
//TAknWindowLineLayout guideLineTop = AknLayoutScalable_Avkon::fep_hwr_write_pane_g5(0).LayoutLine();
|
|
680 |
//TAknWindowLineLayout guideLineBottom = AknLayoutScalable_Avkon::fep_hwr_write_pane_g6(0).LayoutLine();
|
|
681 |
|
|
682 |
iGuideLineTopTl.iX = rect.iTl.iX + leftrightmargin;
|
|
683 |
iGuideLineTopTl.iY = rect.iTl.iY + topmargin;
|
|
684 |
|
|
685 |
iGuideLineTopBr.iX = rect.iBr.iX - leftrightmargin;
|
|
686 |
iGuideLineTopBr.iY = rect.iTl.iY + topmargin;
|
|
687 |
|
|
688 |
iGuideLineBottomTl.iX = rect.iTl.iX + leftrightmargin;
|
|
689 |
iGuideLineBottomTl.iY = rect.iTl.iY + bottommargin;
|
|
690 |
|
|
691 |
iGuideLineBottomBr.iX = rect.iBr.iX - leftrightmargin;
|
|
692 |
iGuideLineBottomBr.iY = rect.iTl.iY + bottommargin;
|
|
693 |
|
|
694 |
iGuideLineSet = ETrue;
|
|
695 |
}
|
|
696 |
|
|
697 |
// --------------------------------------------------------------------------
|
|
698 |
// CPeninputHwrBxAbWnd::DrawGuideLine
|
|
699 |
// (other items were commented in a header)
|
|
700 |
// --------------------------------------------------------------------------
|
|
701 |
//
|
|
702 |
void CPeninputHwrBxAbWnd::DrawGuideLine()
|
|
703 |
{
|
|
704 |
// Set guide line
|
|
705 |
if ( ConfigInfo() )
|
|
706 |
{
|
|
707 |
TInt style = ConfigInfo()->GuideLine();
|
|
708 |
|
|
709 |
CPeninputHwrBxAbDataMgr::THandWritingPenData* penData =
|
|
710 |
( CPeninputHwrBxAbDataMgr::THandWritingPenData* )
|
|
711 |
iLayoutContext->RequestData( EPeninputDataTypeReserve_1 );
|
|
712 |
|
|
713 |
TInt language = penData->iRecognizer->GetLanguage();
|
|
714 |
|
|
715 |
TInt curRange = CPeninputDataConverter::AnyToInt
|
|
716 |
( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) );
|
|
717 |
|
|
718 |
if(language == ELangHindi && curRange == ERangeNative)
|
|
719 |
style = EPeninputGuideLineTop;
|
|
720 |
|
|
721 |
iHwBox->SetGuideLineStyle( style );
|
|
722 |
|
|
723 |
// if size changing, or guide line pos has not been set
|
|
724 |
CalculateGuideLinePos();
|
|
725 |
|
|
726 |
if ( style == EPeninputGuideLineTop)
|
|
727 |
{
|
|
728 |
iHwBox->SetTopGuideLinePosition(iGuideLineTopTl, iGuideLineTopBr);
|
|
729 |
}
|
|
730 |
else if ( style == EPeninputGuideLineBottom)
|
|
731 |
{
|
|
732 |
iHwBox->SetBottomGuideLinePosition(iGuideLineBottomTl, iGuideLineBottomBr);
|
|
733 |
}
|
|
734 |
else if ( style == EPeninputGuideLineBoth)
|
|
735 |
{
|
|
736 |
iHwBox->SetTopGuideLinePosition(iGuideLineTopTl, iGuideLineTopBr);
|
|
737 |
iHwBox->SetBottomGuideLinePosition(iGuideLineBottomTl, iGuideLineBottomBr);
|
|
738 |
}
|
|
739 |
|
|
740 |
iHwBox->RefreshUI();
|
|
741 |
}
|
|
742 |
}
|
|
743 |
// --------------------------------------------------------------------------
|
|
744 |
// CPeninputHwrBxAbWnd::SetControlsFont
|
|
745 |
// (other items were commented in a header)
|
|
746 |
// --------------------------------------------------------------------------
|
|
747 |
//
|
|
748 |
void CPeninputHwrBxAbWnd::SetControlsFont()
|
|
749 |
{
|
|
750 |
TAknTextLineLayout textPaneTextLayout;
|
|
751 |
TAknLayoutText txt;
|
|
752 |
textPaneTextLayout =
|
|
753 |
AknLayoutScalable_Avkon::fep_hwr_top_text_pane_t1().LayoutLine();
|
|
754 |
|
|
755 |
TInt leftMargin, rightMargin, topMargin, txtHeight;
|
|
756 |
|
|
757 |
CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*>
|
|
758 |
(Control(EPeninputWindowCtrlIdMultiLineICF));
|
|
759 |
TRect rect = icf->Rect();
|
|
760 |
txt.LayoutText( rect, textPaneTextLayout );
|
|
761 |
TRect txtRect = txt.TextRect();
|
|
762 |
leftMargin = txtRect.iTl.iX - rect.iTl.iX;
|
|
763 |
rightMargin = rect.iBr.iX - txtRect.iBr.iX;
|
|
764 |
topMargin = txtRect.iTl.iY - rect.iTl.iY;
|
|
765 |
txtHeight = txtRect.Height();
|
|
766 |
|
|
767 |
icf->SetTextMargin( leftMargin, rightMargin, topMargin, 0);
|
|
768 |
icf->SetLineSpace( 1 );
|
|
769 |
const CFont* icfFont = AknLayoutUtils::FontFromId( textPaneTextLayout.iFont, NULL );
|
|
770 |
|
|
771 |
TRAP_IGNORE(icf->SizeChangedL(
|
|
772 |
static_cast<CFepLayoutMultiLineIcf*>(
|
|
773 |
Control(EPeninputWindowCtrlIdMultiLineICF))->Rect(),
|
|
774 |
txtHeight,
|
|
775 |
icfFont->FontMaxHeight(),
|
|
776 |
icfFont));
|
|
777 |
}
|
|
778 |
|
|
779 |
// --------------------------------------------------------------------------
|
|
780 |
// CPeninputHwrBxAbWnd::AddRangeBarL
|
|
781 |
// (other items were commented in a header)
|
|
782 |
// --------------------------------------------------------------------------
|
|
783 |
//
|
|
784 |
void CPeninputHwrBxAbWnd::AddRangeBarL()
|
|
785 |
{
|
|
786 |
// Range bar
|
|
787 |
iRangeBar = CAknFepCtrlRangeBar::NewL( UiLayout(),
|
|
788 |
EPeninutWindowCtrlIdRangeBar,
|
|
789 |
CAknFepCtrlRangeBar::EBtnGroupVertical );
|
|
790 |
|
|
791 |
// Set event id
|
|
792 |
iRangeBar->SetEventIdForRange( EPeninputLayoutEventRange );
|
|
793 |
iRangeBar->SetEventIdForCase( EPeninputLayoutEventRangeLoop );
|
|
794 |
// ClientPane()->AddControlL(iRangeBar);
|
|
795 |
// iRangeBar->AddEventObserver(UiLayout());
|
|
796 |
if (iCtrlPool)
|
|
797 |
{
|
|
798 |
iCtrlPool->AddControl(iRangeBar);
|
|
799 |
}
|
|
800 |
}
|
|
801 |
|
|
802 |
// --------------------------------------------------------------------------
|
|
803 |
// CPeninputHwrBxAbWnd::AddButtonL
|
|
804 |
// (other items were commented in a header)
|
|
805 |
// --------------------------------------------------------------------------
|
|
806 |
//
|
|
807 |
CAknFepCtrlEventButton* CPeninputHwrBxAbWnd::AddButtonL(
|
|
808 |
const TInt aControlId, const TInt aEventId, const TInt aResId,
|
|
809 |
const TInt aUnicode, const TBool aIsRepeat )
|
|
810 |
{
|
|
811 |
CAknFepCtrlEventButton* button = NULL;
|
|
812 |
|
|
813 |
if ( aIsRepeat )
|
|
814 |
{
|
|
815 |
button = CAknFepCtrlRepeatButton::NewL( UiLayout(), aControlId,
|
|
816 |
aEventId, aUnicode );
|
|
817 |
}
|
|
818 |
else
|
|
819 |
{
|
|
820 |
button = CAknFepCtrlEventButton::NewL( UiLayout(), aControlId,
|
|
821 |
aEventId, aUnicode,
|
|
822 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
823 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
824 |
KAknsIIDQsnFrFunctionButtonInactive );
|
|
825 |
}
|
|
826 |
|
|
827 |
CleanupStack::PushL( button );
|
|
828 |
if ( button )
|
|
829 |
{
|
|
830 |
// Read resource
|
|
831 |
TResourceReader reader;
|
|
832 |
|
|
833 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId );
|
|
834 |
button->SetResourceId( aResId );
|
|
835 |
button->ConstructFromResourceL();
|
|
836 |
// Pop and destroy reader
|
|
837 |
CleanupStack::PopAndDestroy( 1 );
|
|
838 |
|
|
839 |
// Add into the control pool
|
|
840 |
if ( iCtrlPool )
|
|
841 |
{
|
|
842 |
iCtrlPool->AddControl( button );
|
|
843 |
}
|
|
844 |
}
|
|
845 |
CleanupStack::Pop( button );
|
|
846 |
|
|
847 |
return button;
|
|
848 |
}
|
|
849 |
void CPeninputHwrBxAbWnd::AddBackspaceButtonL()
|
|
850 |
{
|
|
851 |
iBackspaceButton = CAknFepCtrlRepeatButton::NewL(
|
|
852 |
UiLayout(), EPeninutWindowCtrlIdBackspaceBtn,
|
|
853 |
EPeninputLayoutEventBack, EKeyBackspace,
|
|
854 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
855 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
856 |
KAknsIIDQsnFrFunctionButtonInactive );
|
|
857 |
// iBackspaceButton->AddEventObserver( UiLayout() );
|
|
858 |
// Read resource
|
|
859 |
TResourceReader reader;
|
|
860 |
|
|
861 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_LAYOUT_HWR_BACKSPACE );
|
|
862 |
iBackspaceButton->SetResourceId( R_PENINPUT_LAYOUT_HWR_BACKSPACE );
|
|
863 |
iBackspaceButton->ConstructFromResourceL();
|
|
864 |
// Pop and destroy reader
|
|
865 |
CleanupStack::PopAndDestroy( 1 );
|
|
866 |
}
|
|
867 |
// --------------------------------------------------------------------------
|
|
868 |
// CPeninputHwrBxAbWnd::AddHwBoxL
|
|
869 |
// (other items were commented in a header)
|
|
870 |
// --------------------------------------------------------------------------
|
|
871 |
//
|
|
872 |
void CPeninputHwrBxAbWnd::AddHwBoxL()
|
|
873 |
{
|
|
874 |
CPeninputHwrBxAbDataMgr::THandWritingPenData* penData =
|
|
875 |
( CPeninputHwrBxAbDataMgr::THandWritingPenData* )
|
|
876 |
iLayoutContext->RequestData( EPeninputDataTypeReserve_1 );
|
|
877 |
|
|
878 |
iHwBox = CTransparentHwrWndExt::NewL( Rect(), UiLayout(),
|
|
879 |
EPeninutWindowCtrlIdHwrBox,
|
|
880 |
EFalse, penData->iGuideLineOn );
|
|
881 |
iHwBox->SetEnableFade( ETrue );
|
|
882 |
iHwBox->EnableTraceOutsideWindow( EFalse );
|
|
883 |
iHwBox->SetWndTransparencyFactor(iNormalTransFactor);
|
|
884 |
|
|
885 |
if ( iCtrlPool )
|
|
886 |
{
|
|
887 |
iCtrlPool->AddControl( iHwBox );
|
|
888 |
}
|
|
889 |
|
|
890 |
SetHwBoxFrameBackColor();
|
|
891 |
}
|
|
892 |
// ---------------------------------------------------------
|
|
893 |
// Add dropdown list to window
|
|
894 |
// ---------------------------------------------------------
|
|
895 |
//
|
|
896 |
void CPeninputHwrBxAbWnd::AddDropdownListL(TBool aLandscapeStyle)
|
|
897 |
{
|
|
898 |
TResourceReader reader;
|
|
899 |
CCoeEnv::Static()->CreateResourceReaderLC(reader,R_PENINPUT_LAYOUT_DROP_DOWN_LIST);
|
|
900 |
|
|
901 |
// iSecondRangeColor = TRgb(0xFF0000);
|
|
902 |
|
|
903 |
ReadLafInfo(aLandscapeStyle);
|
|
904 |
TAknTextLineLayout candTextLayout =
|
|
905 |
AknLayoutScalable_Avkon::cell_hwr_candidate_pane_t1(0).LayoutLine();
|
|
906 |
|
|
907 |
TInt textMargin = (iUnitHeight -
|
|
908 |
AknLayoutUtils::FontFromId(candTextLayout.iFont, NULL)->HeightInPixels())/2;
|
|
909 |
|
|
910 |
TDropdownListDrawInfo candiDrawInfo(KAknsIIDQsnFrFunctionButtonInactive,
|
|
911 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
912 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
913 |
KAknsIIDQsnFrItutButtonCandiSideL,
|
|
914 |
KAknsIIDQsnFrItutButtonCandiMiddle,
|
|
915 |
KAknsIIDQsnFrItutButtonCandiSideR,
|
|
916 |
KAknsIIDQsnFrItutButtonCandiPressedSideL,
|
|
917 |
KAknsIIDQsnFrItutButtonCandiPressedMiddle,
|
|
918 |
KAknsIIDQsnFrItutButtonCandiPressedSideR,
|
|
919 |
TRgb(194, 221, 242),
|
|
920 |
ETrue);
|
|
921 |
CFont* listfont = (CFont *)AknLayoutUtils::FontFromId(candTextLayout.iFont, NULL);
|
|
922 |
|
|
923 |
iDropdownList = CFepCtrlDropdownList::NewL(UiLayout(),
|
|
924 |
EPentinputHwrCandidateList,
|
|
925 |
R_PENINPUT_LAYOUT_DROP_DOWN_LIST,
|
|
926 |
TPoint(Rect().iTl.iX + 3, Rect().iTl.iY + 3 + iUnitHeight),
|
|
927 |
listfont ,
|
|
928 |
TSize(iUnitWidth,iUnitHeight),
|
|
929 |
iUnitWidth,
|
|
930 |
6,2,
|
|
931 |
iUnitHeight,
|
|
932 |
0,
|
|
933 |
0,
|
|
934 |
CFepCtrlDropdownList::ECandFromRToL,
|
|
935 |
EFalse);
|
|
936 |
if ( iCtrlPool )
|
|
937 |
{
|
|
938 |
iCtrlPool->AddControl( iDropdownList );
|
|
939 |
}
|
|
940 |
iDropdownList->SetFont(listfont);
|
|
941 |
iDropdownList->SetEventIdForCandidateSelected(EPeninputLayoutHwrEventCandidateSelected);
|
|
942 |
//iDropdownList->SetEventIdForNextPageCandidate(EPeninputLayoutHwrEventGetNextCandidatePage);
|
|
943 |
//iDropdownList->SetEventIdForPreviousPageCandidate(EPeninputLayoutHwrEventGetPreviousCandidatePage);
|
|
944 |
iDropdownList->SetEventIdForCandidateExisted(EPeninputLayoutHwrEventCandidateExisted);
|
|
945 |
iDropdownList->SetCandTruncateType(CFepCtrlDropdownList::ECandTruncateFromBeginning);
|
|
946 |
iDropdownList->SetDropdownListImgID(candiDrawInfo);
|
|
947 |
|
|
948 |
CleanupStack::PopAndDestroy(); // reader
|
|
949 |
}
|
|
950 |
// ---------------------------------------------------------
|
|
951 |
// CAknFepHwrBxWnd::ReadUnitSize
|
|
952 |
// ---------------------------------------------------------
|
|
953 |
//
|
|
954 |
void CPeninputHwrBxAbWnd::ReadLafInfo(TBool aLandscapeStyle)
|
|
955 |
{
|
|
956 |
//if (iDataMgr->SizeChanging())// || (!iUnitShadowSizeSet))
|
|
957 |
{
|
|
958 |
// if size is changing, or unit size, shadow size have not been set yet
|
|
959 |
TAknWindowLineLayout appWnd;
|
|
960 |
TAknWindowLineLayout mainPane;
|
|
961 |
TAknWindowLineLayout wndLayout;
|
|
962 |
TAknWindowLineLayout unitLayout;
|
|
963 |
TAknWindowLineLayout shadowPane;
|
|
964 |
TAknWindowLineLayout shadowTl;
|
|
965 |
TAknWindowLineLayout shadowBr;
|
|
966 |
TAknLayoutRect mainPaneRect;
|
|
967 |
TAknLayoutRect wndRect;
|
|
968 |
TAknLayoutRect unitRect;
|
|
969 |
TAknLayoutRect shadowRect;
|
|
970 |
TAknLayoutRect shadowTlRect;
|
|
971 |
TAknLayoutRect shadowBrRect;
|
|
972 |
|
|
973 |
// Get hwr window layout
|
|
974 |
appWnd = AknLayoutScalable_Avkon::application_window(0).LayoutLine();
|
|
975 |
|
|
976 |
if (aLandscapeStyle)
|
|
977 |
{
|
|
978 |
// landscape
|
|
979 |
mainPane = AknLayoutScalable_Avkon::main_pane(4).LayoutLine();
|
|
980 |
wndLayout = AknLayoutScalable_Avkon::popup_fep_hwr_window(2).LayoutLine();
|
|
981 |
}
|
|
982 |
else
|
|
983 |
{
|
|
984 |
// portrait
|
|
985 |
mainPane = AknLayoutScalable_Avkon::main_pane(1).LayoutLine();
|
|
986 |
wndLayout = AknLayoutScalable_Avkon::popup_fep_hwr_window(0).LayoutLine();
|
|
987 |
}
|
|
988 |
|
|
989 |
mainPaneRect.LayoutRect(appWnd.Rect(), mainPane);
|
|
990 |
wndRect.LayoutRect(mainPaneRect.Rect(), wndLayout);
|
|
991 |
|
|
992 |
unitLayout = AknLayoutScalable_Avkon::fep_hwr_aid_pane(1).LayoutLine();
|
|
993 |
unitRect.LayoutRect(wndRect.Rect(), unitLayout);
|
|
994 |
|
|
995 |
TRect hwrWndRect = TRect(0,
|
|
996 |
0,
|
|
997 |
wndRect.Rect().Width(),
|
|
998 |
wndRect.Rect().Height());
|
|
999 |
|
|
1000 |
iUnitWidth = unitRect.Rect().Width();
|
|
1001 |
iUnitHeight = unitRect.Rect().Height();
|
|
1002 |
|
|
1003 |
shadowPane = AknLayoutScalable_Avkon::bg_popup_fep_shadow_pane(2).LayoutLine();
|
|
1004 |
shadowRect.LayoutRect(hwrWndRect, shadowPane);
|
|
1005 |
|
|
1006 |
shadowTl = AknLayoutScalable_Avkon::bg_popup_fep_shadow_pane_g1().LayoutLine();
|
|
1007 |
shadowTlRect.LayoutRect(shadowRect.Rect(), shadowTl);
|
|
1008 |
|
|
1009 |
shadowBr = AknLayoutScalable_Avkon::bg_popup_fep_shadow_pane_g8().LayoutLine();
|
|
1010 |
shadowBrRect.LayoutRect(shadowRect.Rect(), shadowBr);
|
|
1011 |
|
|
1012 |
iShadowTl = shadowTlRect.Rect().Size();
|
|
1013 |
iShadowBr = shadowBrRect.Rect().Size();
|
|
1014 |
|
|
1015 |
//iUnitShadowSizeSet = ETrue;
|
|
1016 |
}
|
|
1017 |
}
|
|
1018 |
|
|
1019 |
// --------------------------------------------------------------------------
|
|
1020 |
// CPeninputHwrBxAbWnd::SetHwBoxFrameBackColor
|
|
1021 |
// (other items were commented in a header)
|
|
1022 |
// --------------------------------------------------------------------------
|
|
1023 |
//
|
|
1024 |
void CPeninputHwrBxAbWnd::SetHwBoxFrameBackColor()
|
|
1025 |
{
|
|
1026 |
TRgb frameColor;
|
|
1027 |
TRgb backColor;
|
|
1028 |
TAknsItemID id;
|
|
1029 |
|
|
1030 |
id.Set(KWriteBoxFrameBackColorMajor, KWriteBoxFrameBackColorGrp);
|
|
1031 |
|
|
1032 |
TInt error = AknsUtils::GetCachedColor(UiLayout()->SkinInstance(),
|
|
1033 |
frameColor,
|
|
1034 |
id,
|
|
1035 |
KWriteBoxFrameBackColorIdx);
|
|
1036 |
|
|
1037 |
if (error != KErrNone)
|
|
1038 |
{
|
|
1039 |
frameColor = TRgb(KDefaultWriteBoxFrameColor);
|
|
1040 |
backColor = TRgb(KDefaultWriteBoxBackColor);
|
|
1041 |
}
|
|
1042 |
else
|
|
1043 |
{
|
|
1044 |
backColor = frameColor;
|
|
1045 |
}
|
|
1046 |
|
|
1047 |
if (iHwBox)
|
|
1048 |
{
|
|
1049 |
iHwBox->SetFrameCol(frameColor);
|
|
1050 |
iHwBox->SetBkColor(backColor);
|
|
1051 |
}
|
|
1052 |
}
|
|
1053 |
|
|
1054 |
// --------------------------------------------------------------------------
|
|
1055 |
// CPeninputHwrBxAbWnd::PopupChoiceList
|
|
1056 |
// (other items were commented in a header)
|
|
1057 |
// --------------------------------------------------------------------------
|
|
1058 |
//
|
|
1059 |
void CPeninputHwrBxAbWnd::PopupChoiceList()
|
|
1060 |
{
|
|
1061 |
}
|
|
1062 |
|
|
1063 |
// --------------------------------------------------------------------------
|
|
1064 |
// CPeninputHwrBxAbWnd::DoCaseChange
|
|
1065 |
// (other items were commented in a header)
|
|
1066 |
// --------------------------------------------------------------------------
|
|
1067 |
//
|
|
1068 |
void CPeninputHwrBxAbWnd::DoCaseChange( TInt aNewCase )
|
|
1069 |
{
|
|
1070 |
if( iDisableCaseChange )
|
|
1071 |
{
|
|
1072 |
iCachedCase = aNewCase;
|
|
1073 |
return;
|
|
1074 |
}
|
|
1075 |
|
|
1076 |
TInt curRange = CPeninputDataConverter::AnyToInt
|
|
1077 |
( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) );
|
|
1078 |
TInt index = 0;
|
|
1079 |
|
|
1080 |
if ( ( curRange == ERangeEnglish )
|
|
1081 |
|| ( ( curRange == ERangeNative ) && ( ConfigInfo()->CaseSensitive() ) ) )
|
|
1082 |
{
|
|
1083 |
switch ( aNewCase )
|
|
1084 |
{
|
|
1085 |
case ECaseUpper:
|
|
1086 |
{
|
|
1087 |
index = 2;
|
|
1088 |
}
|
|
1089 |
break;
|
|
1090 |
case ECaseLower:
|
|
1091 |
{
|
|
1092 |
index = 1;
|
|
1093 |
}
|
|
1094 |
break;
|
|
1095 |
case ECaseText:
|
|
1096 |
{
|
|
1097 |
index = 0;
|
|
1098 |
}
|
|
1099 |
break;
|
|
1100 |
default:
|
|
1101 |
break;
|
|
1102 |
}
|
|
1103 |
|
|
1104 |
TRAP_IGNORE( iRangeBar->SetCaseL( curRange, index ) );
|
|
1105 |
iLayoutContext->SetData( EPeninputDataTypeCase, &aNewCase );
|
|
1106 |
}
|
|
1107 |
//to modify guideline pos.
|
|
1108 |
iHwBox->RefreshUI();
|
|
1109 |
DrawGuideLine();
|
|
1110 |
}
|
|
1111 |
|
|
1112 |
// --------------------------------------------------------------------------
|
|
1113 |
// CPeninputHwrBxAbWnd::OnStrokeStarted
|
|
1114 |
// (other items were commented in a header)
|
|
1115 |
// --------------------------------------------------------------------------
|
|
1116 |
//
|
|
1117 |
void CPeninputHwrBxAbWnd::OnStrokeStarted()
|
|
1118 |
{
|
|
1119 |
iDisableCaseChange = ETrue;
|
|
1120 |
iHwBox->SetWndTransparencyFactor(iWriteTransFactor);
|
|
1121 |
if( !iCharacterStart )
|
|
1122 |
{
|
|
1123 |
iCharacterStart = ETrue;
|
|
1124 |
|
|
1125 |
TBuf<4> buf;
|
|
1126 |
buf.Append(reinterpret_cast<TText*>(&iCharacterStart), sizeof(TBool)/sizeof(TText));
|
|
1127 |
iLayoutContext->Sendkey( ESignalCharacterStart, buf );
|
|
1128 |
|
|
1129 |
}
|
|
1130 |
}
|
|
1131 |
|
|
1132 |
// --------------------------------------------------------------------------
|
|
1133 |
// CPeninputHwrBxAbWnd::OnStrokeFinished
|
|
1134 |
// (other items were commented in a header)
|
|
1135 |
// --------------------------------------------------------------------------
|
|
1136 |
//
|
|
1137 |
void CPeninputHwrBxAbWnd::OnStrokeFinished()
|
|
1138 |
{
|
|
1139 |
// No trace
|
|
1140 |
if ( !iHwBox->HasNewTrace() )
|
|
1141 |
{
|
|
1142 |
return;
|
|
1143 |
}
|
|
1144 |
|
|
1145 |
RArray<TPoint> strokes = iHwBox->StrokeList();
|
|
1146 |
|
|
1147 |
iStrokeArray.Reset();
|
|
1148 |
|
|
1149 |
const TInt count = strokes.Count();
|
|
1150 |
|
|
1151 |
#ifdef _NOT_USING_DECUMA_MCR_
|
|
1152 |
// similar as S90
|
|
1153 |
|
|
1154 |
for ( TInt i = 0; i < count; i++ )
|
|
1155 |
{
|
|
1156 |
iStrokeArray.Append( strokes[i] );
|
|
1157 |
}
|
|
1158 |
|
|
1159 |
CPeninputHwrBxAbDataMgr::THandWritingPenData* penData =
|
|
1160 |
( CPeninputHwrBxAbDataMgr::THandWritingPenData* )
|
|
1161 |
iLayoutContext->RequestData( EPeninputDataTypeReserve_1 );
|
|
1162 |
|
|
1163 |
TInt err = penData->iRecognizer->Recognize( iStrokeArray, iRecogResult );
|
|
1164 |
|
|
1165 |
if ( err == KErrNone && iRecogResult.Count() > 0 )
|
|
1166 |
{
|
|
1167 |
TInt dataType = CPeninputDataConverter::AnyToInt(iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ));
|
|
1168 |
if (dataType == ERangeNative)
|
|
1169 |
{
|
|
1170 |
if( iRecogResult[0]->Locate( EKeyBackspace ) == KErrNotFound
|
|
1171 |
&& iRecogResult[0]->Locate( EKeyFormFeed ) == KErrNotFound
|
|
1172 |
&& iRecogResult[0]->Locate( EKeySpace ) == KErrNotFound
|
|
1173 |
&& iRecogResult[0]->Locate( EKeyEnter ) == KErrNotFound
|
|
1174 |
&& iRecogResult[0]->Locate(EKeyDelete) == KErrNotFound)
|
|
1175 |
{
|
|
1176 |
for (TInt i = 1; i < iRecogResult.Count(); i++)
|
|
1177 |
{
|
|
1178 |
if((iRecogResult[i]->Locate( EKeyBackspace ) != KErrNotFound)
|
|
1179 |
||(iRecogResult[i]->Locate( EKeySpace ) != KErrNotFound)
|
|
1180 |
||(iRecogResult[i]->Locate( EKeyLineFeed ) != KErrNotFound)
|
|
1181 |
||(iRecogResult[i]->Locate( EKeyEnter ) != KErrNotFound))
|
|
1182 |
{
|
|
1183 |
delete iRecogResult[i];
|
|
1184 |
iRecogResult.Remove(i);
|
|
1185 |
}
|
|
1186 |
}
|
|
1187 |
iDropdownList->Hide(EFalse);
|
|
1188 |
TRAP_IGNORE(iDropdownList->SetCandidatesL(iRecogResult,
|
|
1189 |
CFepCtrlDropdownList::EListExpandableMultiRowWithoutIcon ));
|
|
1190 |
iDropdownList->SetHighlightCell(0);
|
|
1191 |
}
|
|
1192 |
else
|
|
1193 |
{
|
|
1194 |
ResetAndShowDropdownList();
|
|
1195 |
}
|
|
1196 |
}
|
|
1197 |
else
|
|
1198 |
{
|
|
1199 |
ClearAndCloseDropdownList();
|
|
1200 |
}
|
|
1201 |
|
|
1202 |
SubmitRecognitionResult( iRecogResult[0] );
|
|
1203 |
|
|
1204 |
|
|
1205 |
}
|
|
1206 |
#else
|
|
1207 |
|
|
1208 |
for ( TInt i = 0; i < count; i++ )
|
|
1209 |
{
|
|
1210 |
iStrokeArray.Append( strokes[i] );
|
|
1211 |
}
|
|
1212 |
|
|
1213 |
#endif
|
|
1214 |
}
|
|
1215 |
|
|
1216 |
// --------------------------------------------------------------------------
|
|
1217 |
// CPeninputHwrBxAbWnd::OnStrokeCharacterTimerOut
|
|
1218 |
// (other items were commented in a header)
|
|
1219 |
// --------------------------------------------------------------------------
|
|
1220 |
//
|
|
1221 |
void CPeninputHwrBxAbWnd::OnStrokeCharacterTimerOut()
|
|
1222 |
{
|
|
1223 |
iDisableCaseChange = EFalse;
|
|
1224 |
DoCaseChange(iCachedCase);
|
|
1225 |
iHwBox->SetWndTransparencyFactor(iNormalTransFactor);
|
|
1226 |
#ifdef _NOT_USING_DECUMA_MCR_
|
|
1227 |
// similar as S90
|
|
1228 |
CPeninputHwrBxAbDataMgr::THandWritingPenData* penData =
|
|
1229 |
( CPeninputHwrBxAbDataMgr::THandWritingPenData* )
|
|
1230 |
iLayoutContext->RequestData( EPeninputDataTypeReserve_1 );
|
|
1231 |
|
|
1232 |
TInt language = penData->iRecognizer->GetLanguage();
|
|
1233 |
if( language == ELangThai || language == ELangHindi || language == ELangVietnamese )
|
|
1234 |
{
|
|
1235 |
// This is a workarround to clear the recognizer.
|
|
1236 |
RArray<TPoint> stroke_array;
|
|
1237 |
stroke_array.Reset();
|
|
1238 |
// Call recognize with a empty array of stroke is the condition
|
|
1239 |
// to clear the context>
|
|
1240 |
TInt err = penData->iRecognizer->Recognize( stroke_array, iRecogResult );
|
|
1241 |
if( err == KErrNone && iRecogResult.Count() > 0 )
|
|
1242 |
{
|
|
1243 |
TInt dataType = CPeninputDataConverter::AnyToInt(iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ));
|
|
1244 |
if (dataType == ERangeNative)
|
|
1245 |
{
|
|
1246 |
iDropdownList->Hide(EFalse);
|
|
1247 |
TRAP_IGNORE(iDropdownList->SetCandidatesL(iRecogResult, CFepCtrlDropdownList::EListExpandableMultiRowWithoutIcon ));
|
|
1248 |
}
|
|
1249 |
else
|
|
1250 |
{
|
|
1251 |
ClearAndCloseDropdownList();
|
|
1252 |
}
|
|
1253 |
SubmitRecognitionResult( iRecogResult[0] );
|
|
1254 |
}
|
|
1255 |
}
|
|
1256 |
|
|
1257 |
delete iLastResult;
|
|
1258 |
iLastResult = NULL;
|
|
1259 |
|
|
1260 |
#else
|
|
1261 |
|
|
1262 |
CPeninputHwrBxAbDataMgr::THandWritingPenData* penData =
|
|
1263 |
( CPeninputHwrBxAbDataMgr::THandWritingPenData* )
|
|
1264 |
iLayoutContext->RequestData( EPeninputDataTypeReserve_1 );
|
|
1265 |
|
|
1266 |
TInt err = penData->iRecognizer->Recognize( iStrokeArray, iRecogResult );
|
|
1267 |
if ( err == KErrNone && iRecogResult.Count() > 0 )
|
|
1268 |
{
|
|
1269 |
const HBufC* res = iRecogResult[0];
|
|
1270 |
iLayoutContext->Sendkey( ESignalKeyEvent, *res );
|
|
1271 |
}
|
|
1272 |
iStrokeArray.Reset();
|
|
1273 |
|
|
1274 |
#endif
|
|
1275 |
iCharacterStart = EFalse;
|
|
1276 |
}
|
|
1277 |
|
|
1278 |
// --------------------------------------------------------------------------
|
|
1279 |
// CPeninputHwrBxAbWnd::OnStrokeCanceled
|
|
1280 |
// (other items were commented in a header)
|
|
1281 |
// --------------------------------------------------------------------------
|
|
1282 |
//
|
|
1283 |
void CPeninputHwrBxAbWnd::OnStrokeCanceled()
|
|
1284 |
{
|
|
1285 |
iDisableCaseChange = EFalse;
|
|
1286 |
iHwBox->SetWndTransparencyFactor(iNormalTransFactor);
|
|
1287 |
#ifdef _NOT_USING_DECUMA_MCR_
|
|
1288 |
// similar as S90
|
|
1289 |
CPeninputHwrBxAbDataMgr::THandWritingPenData* penData =
|
|
1290 |
( CPeninputHwrBxAbDataMgr::THandWritingPenData* )
|
|
1291 |
iLayoutContext->RequestData( EPeninputDataTypeReserve_1 );
|
|
1292 |
|
|
1293 |
TInt language = penData->iRecognizer->GetLanguage();
|
|
1294 |
if( language == ELangThai || language == ELangHindi || language == ELangVietnamese )
|
|
1295 |
{
|
|
1296 |
// This is a workarround to clear the recognizer.
|
|
1297 |
RArray<TPoint> stroke_array;
|
|
1298 |
stroke_array.Reset();
|
|
1299 |
// Call recognize with a empty array of stroke is the condition
|
|
1300 |
// to clear the context>
|
|
1301 |
TInt err = penData->iRecognizer->Recognize( stroke_array, iRecogResult );
|
|
1302 |
// if( err == KErrNone && iRecogResult.Count() > 0 )
|
|
1303 |
// {
|
|
1304 |
// SubmitRecognitionResult( iRecogResult[0] );
|
|
1305 |
// }
|
|
1306 |
}
|
|
1307 |
|
|
1308 |
delete iLastResult;
|
|
1309 |
iLastResult = NULL;
|
|
1310 |
|
|
1311 |
|
|
1312 |
#endif
|
|
1313 |
iCharacterStart = EFalse;
|
|
1314 |
}
|
|
1315 |
|
|
1316 |
// -----------------------------------------------------------------------------
|
|
1317 |
// CPeninputHwrBxAbWnd::ConstructFromResourceL
|
|
1318 |
// (other items were commented in a header).
|
|
1319 |
// -----------------------------------------------------------------------------
|
|
1320 |
//
|
|
1321 |
void CPeninputHwrBxAbWnd::ConstructFromResourceL()
|
|
1322 |
{
|
|
1323 |
CPeninputLayoutWindow::ConstructFromResourceL();
|
|
1324 |
|
|
1325 |
if (iLangSwitchBtn)
|
|
1326 |
{
|
|
1327 |
SetSwitchBtnTextColor(*iLangSwitchBtn);
|
|
1328 |
}
|
|
1329 |
iBackspaceMirrored = EFalse;
|
|
1330 |
if(!iBackspaceButton)
|
|
1331 |
{
|
|
1332 |
AddBackspaceButtonL();
|
|
1333 |
// Add into the group
|
|
1334 |
CControlGroup* headerPane = HeaderPane();
|
|
1335 |
headerPane->AddControlL(iBackspaceButton);
|
|
1336 |
iBackspaceButton->AddEventObserver(UiLayout());
|
|
1337 |
}
|
|
1338 |
SetHwBoxFrameBackColor();
|
|
1339 |
|
|
1340 |
TRgb* penColor =
|
|
1341 |
( TRgb* ) iLayoutContext->RequestData(EPeninputDataTypePenTailColor);
|
|
1342 |
if (iHwBox)
|
|
1343 |
{
|
|
1344 |
iHwBox->SetPenColor( *penColor);
|
|
1345 |
}
|
|
1346 |
}
|
|
1347 |
|
|
1348 |
// ---------------------------------------------------------------------------
|
|
1349 |
// CPeninputHwrBxAbWnd::PopupSwitchWindow
|
|
1350 |
// (other items were commented in a header).
|
|
1351 |
// ---------------------------------------------------------------------------
|
|
1352 |
//
|
|
1353 |
void CPeninputHwrBxAbWnd::PopupSwitchWindow()
|
|
1354 |
{
|
|
1355 |
CFepUiBaseCtrl* modeSwitchBtn = Control(EPeninutWindowCtrlIdSwitchToVkbBtn);
|
|
1356 |
|
|
1357 |
if ( modeSwitchBtn )
|
|
1358 |
{
|
|
1359 |
TRect rect = modeSwitchBtn->Rect();
|
|
1360 |
TRAP_IGNORE(iModeSwitchChoice->PopUpSwitchListL(rect));
|
|
1361 |
}
|
|
1362 |
}
|
|
1363 |
// ---------------------------------------------------------------------------
|
|
1364 |
// CPeninputHwrBxAbWnd::OnDeActivate
|
|
1365 |
// (other items were commented in a header).
|
|
1366 |
// ---------------------------------------------------------------------------
|
|
1367 |
//
|
|
1368 |
void CPeninputHwrBxAbWnd::OnDeActivate()
|
|
1369 |
{
|
|
1370 |
//reset range
|
|
1371 |
TInt range = -1;
|
|
1372 |
iLayoutContext->SetData( EPeninputDataTypeCurrentRange, &range );
|
|
1373 |
CPeninputLayoutWindow::OnDeActivate();
|
|
1374 |
iDropdownList->ResetAndClear(CFepCtrlDropdownList::EListExpandableMultiRowWithoutIcon );
|
|
1375 |
iDropdownList->Hide(ETrue);
|
|
1376 |
}
|
|
1377 |
|
|
1378 |
|
|
1379 |
TBool CPeninputHwrBxAbWnd::IsMultiLineIcf()
|
|
1380 |
{
|
|
1381 |
return ETrue;
|
|
1382 |
}
|
|
1383 |
|
|
1384 |
TBool CPeninputHwrBxAbWnd::IsCanChangeRange(TInt aRange)
|
|
1385 |
{
|
|
1386 |
if (aRange == ERangeSymbol)
|
|
1387 |
{
|
|
1388 |
UiLayout()->SignalOwner(ESignalLaunchSCT);
|
|
1389 |
|
|
1390 |
return EFalse;
|
|
1391 |
}
|
|
1392 |
|
|
1393 |
return ETrue;
|
|
1394 |
}
|
|
1395 |
|
|
1396 |
void CPeninputHwrBxAbWnd::ChangeToPreviousRange(TInt aRange)
|
|
1397 |
{
|
|
1398 |
if(iRangeBar)
|
|
1399 |
{
|
|
1400 |
iRangeBar->ActiveRange(aRange);
|
|
1401 |
}
|
|
1402 |
}
|
|
1403 |
|
|
1404 |
inline TBool IsLanguageBidi( TInt aLanguage )
|
|
1405 |
{
|
|
1406 |
return aLanguage == ELangArabic || aLanguage == ELangFarsi ||
|
|
1407 |
aLanguage == ELangHebrew ;
|
|
1408 |
}
|
|
1409 |
void CPeninputHwrBxAbWnd::OnLanguageChange()
|
|
1410 |
{
|
|
1411 |
TBool bidi = IsLanguageBidi( ConfigInfo()->Language() );
|
|
1412 |
iHwBox->SetEnableFade( !bidi );
|
|
1413 |
}
|
|
1414 |
|
|
1415 |
TBool CPeninputHwrBxAbWnd::IsAddingSpace(HBufC* aRes)
|
|
1416 |
{
|
|
1417 |
TInt curRange = CPeninputDataConverter::AnyToInt(iLayoutContext->RequestData(EPeninputDataTypeCurrentRange) );
|
|
1418 |
if (curRange != ERangeNative)
|
|
1419 |
{
|
|
1420 |
return EFalse;
|
|
1421 |
}
|
|
1422 |
if (aRes->Des().Length() == 1)
|
|
1423 |
{
|
|
1424 |
if ( ( *aRes ).Compare(KStandardPuncDotPoint) == 0 ||
|
|
1425 |
( *aRes ).Compare(KStandardPuncExclamatoryPoint) == 0 ||
|
|
1426 |
( *aRes ).Compare(KArabicPuncComma) == 0 ||
|
|
1427 |
( *aRes ).Compare(KArabicPuncSemicolon) == 0 ||
|
|
1428 |
( *aRes ).Compare(KArabicPuncQuestion) == 0 ||
|
|
1429 |
( *aRes ).Compare(KArabicPuncWaw) == 0)
|
|
1430 |
{
|
|
1431 |
return ETrue;
|
|
1432 |
}
|
|
1433 |
}
|
|
1434 |
else if (aRes->Des().Length() > 1)
|
|
1435 |
{
|
|
1436 |
if ( ( *aRes ).Locate(EKeyBackspace) == KErrNotFound &&
|
|
1437 |
( *aRes ).Locate(EKeyFormFeed) == KErrNotFound &&
|
|
1438 |
( *aRes ).Locate(EKeySpace) == KErrNotFound &&
|
|
1439 |
( *aRes ).Locate(EKeyEnter) == KErrNotFound &&
|
|
1440 |
( *aRes ).Locate(EKeyDelete) == KErrNotFound )
|
|
1441 |
{
|
|
1442 |
return ETrue;
|
|
1443 |
}
|
|
1444 |
}
|
|
1445 |
return EFalse;
|
|
1446 |
}
|
|
1447 |
|
|
1448 |
void CPeninputHwrBxAbWnd::SubmitRecognitionResult(HBufC* aRes )
|
|
1449 |
{
|
|
1450 |
_LIT(KSpaceChar, " ");
|
|
1451 |
TBuf<1> buf;
|
|
1452 |
buf.Zero();
|
|
1453 |
buf.Append(KSpaceChar);
|
|
1454 |
|
|
1455 |
if( !iLastResult )
|
|
1456 |
{
|
|
1457 |
if (!IsAddingSpace(aRes))
|
|
1458 |
{
|
|
1459 |
iLayoutContext->Sendkey(ESignalKeyEvent, *aRes);
|
|
1460 |
}
|
|
1461 |
else
|
|
1462 |
{
|
|
1463 |
HBufC* p = HBufC::New(aRes->Length() + buf.Length());
|
|
1464 |
p->Des().Copy(*aRes);
|
|
1465 |
p->Des().Append(buf);
|
|
1466 |
iLayoutContext->Sendkey(ESignalKeyEvent, *p);
|
|
1467 |
delete p;
|
|
1468 |
}
|
|
1469 |
}
|
|
1470 |
else
|
|
1471 |
{
|
|
1472 |
if( iLastResult->Compare( *aRes ) != 0 )
|
|
1473 |
{
|
|
1474 |
//replace
|
|
1475 |
if ( ( *aRes ).Locate( EKeyBackspace ) != KErrNotFound )
|
|
1476 |
{
|
|
1477 |
TBuf<1> buf;
|
|
1478 |
buf.Append( EKeyBackspace );
|
|
1479 |
iLayoutContext->Sendkey( ESignalKeyEvent, buf );
|
|
1480 |
}
|
|
1481 |
else
|
|
1482 |
{
|
|
1483 |
HBufC* p = NULL;
|
|
1484 |
if (IsAddingSpace(aRes))
|
|
1485 |
{
|
|
1486 |
p = HBufC::New(aRes->Length() + 2 + buf.Length());
|
|
1487 |
}
|
|
1488 |
else
|
|
1489 |
{
|
|
1490 |
p = HBufC::New(aRes->Length() + 2);
|
|
1491 |
}
|
|
1492 |
if( p )
|
|
1493 |
{
|
|
1494 |
TInt len = iLastResult->Length();
|
|
1495 |
if (IsAddingSpace(aRes))
|
|
1496 |
{
|
|
1497 |
len += buf.Length();
|
|
1498 |
}
|
|
1499 |
p->Des().Append((TUint16*)&len, 2);
|
|
1500 |
p->Des().Append(*aRes);
|
|
1501 |
if (IsAddingSpace(aRes))
|
|
1502 |
{
|
|
1503 |
p->Des().Append(buf);
|
|
1504 |
}
|
|
1505 |
iLayoutContext->Sendkey( ESignalReplaceText, *p );
|
|
1506 |
delete p;
|
|
1507 |
}
|
|
1508 |
}
|
|
1509 |
}
|
|
1510 |
}
|
|
1511 |
|
|
1512 |
delete iLastResult;
|
|
1513 |
iLastResult = NULL;
|
|
1514 |
|
|
1515 |
if ( (*aRes).Locate( EKeyBackspace ) != KErrNotFound ||
|
|
1516 |
aRes->Length() >= 50 )
|
|
1517 |
{
|
|
1518 |
iHwBox->CancelCharWriting();
|
|
1519 |
}
|
|
1520 |
else
|
|
1521 |
{
|
|
1522 |
iLastResult = aRes->Alloc();
|
|
1523 |
}
|
|
1524 |
}
|
|
1525 |
void CPeninputHwrBxAbWnd::Move(const TPoint& aOffset)
|
|
1526 |
{
|
|
1527 |
CPeninputLayoutWindow::Move(aOffset);
|
|
1528 |
DrawGuideLine();
|
|
1529 |
}
|
|
1530 |
|
|
1531 |
// ---------------------------------------------------------
|
|
1532 |
// Get the candidate
|
|
1533 |
// ---------------------------------------------------------
|
|
1534 |
//
|
|
1535 |
void CPeninputHwrBxAbWnd::GetCandidate(TInt aIndex, TDes& aCharCode) const
|
|
1536 |
{
|
|
1537 |
aCharCode.Zero();
|
|
1538 |
if (aIndex >=0 && aIndex < iRecogResult.Count())
|
|
1539 |
{
|
|
1540 |
aCharCode = *iRecogResult[aIndex];
|
|
1541 |
}
|
|
1542 |
}
|
|
1543 |
|
|
1544 |
// ---------------------------------------------------------
|
|
1545 |
// Cancel writing
|
|
1546 |
// ---------------------------------------------------------
|
|
1547 |
//
|
|
1548 |
void CPeninputHwrBxAbWnd::CancelWriting()
|
|
1549 |
{
|
|
1550 |
if( !iHwBox )
|
|
1551 |
{
|
|
1552 |
//there is nothing to cancel
|
|
1553 |
return;
|
|
1554 |
}
|
|
1555 |
//iHwBox->SetWndTransparencyFactor(iInactiveTrans);
|
|
1556 |
iHwBox->CancelCharWriting();
|
|
1557 |
iDropdownList->ResetAndClear(CFepCtrlDropdownList::EListExpandableMultiRowWithoutIcon );
|
|
1558 |
iDropdownList->Hide(ETrue);
|
|
1559 |
}
|
|
1560 |
|
|
1561 |
void CPeninputHwrBxAbWnd::ClearAndCloseDropdownList()
|
|
1562 |
{
|
|
1563 |
iDropdownList->ResetAndClear(CFepCtrlDropdownList::EListExpandableMultiRowWithoutIcon );
|
|
1564 |
iDropdownList->Hide(ETrue);
|
|
1565 |
}
|
|
1566 |
void CPeninputHwrBxAbWnd::ResetAndShowDropdownList()
|
|
1567 |
{
|
|
1568 |
iDropdownList->ResetAndClear(CFepCtrlDropdownList::EListExpandableMultiRowWithoutIcon );
|
|
1569 |
iDropdownList->Hide(EFalse);
|
|
1570 |
}
|
|
1571 |
void CPeninputHwrBxAbWnd::MirrorBackspaceButtonResL()
|
|
1572 |
{
|
|
1573 |
if(iBackspaceMirrored)
|
|
1574 |
return;
|
|
1575 |
CAknFepCtrlCommonButton* ctrl = static_cast<CAknFepCtrlCommonButton*>(iBackspaceButton);
|
|
1576 |
if( ctrl && iBmpRotator)
|
|
1577 |
{
|
|
1578 |
TSyncRotationAngle rotChoice = CBitmapRotator::EMirrorVerticalAxis;
|
|
1579 |
User::LeaveIfError( iBmpRotator->Rotate( *ctrl->ForgroundBmp() ,
|
|
1580 |
rotChoice ) );
|
|
1581 |
User::LeaveIfError( iBmpRotator->Rotate( *ctrl->ForgroundBmpMask() ,
|
|
1582 |
rotChoice ) );
|
|
1583 |
iBackspaceMirrored = ETrue;
|
|
1584 |
}
|
|
1585 |
}
|
|
1586 |
void CPeninputHwrBxAbWnd::HandleBackspaceKeyEvent()
|
|
1587 |
{
|
|
1588 |
TBuf<1> buf;
|
|
1589 |
buf.Append( EKeyBackspace );
|
|
1590 |
iLayoutContext->Sendkey( ESignalKeyEvent, buf );
|
|
1591 |
}
|