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 vkb window class
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// System includes
|
|
19 |
#include <peninputssqwin.rsg>
|
|
20 |
#include <peninputssqwinconfiginfo_01.rsg>
|
|
21 |
#include <aknfeppeninputenums.h>
|
|
22 |
#include <peninputinputcontextfield.h>
|
|
23 |
#include <peninputpluginutils.h>
|
|
24 |
#include <peninputcommonlayoutext.h>
|
|
25 |
#include <peninputvkbctrllayout.h>
|
|
26 |
#include <peninputvkbctrlext.h>
|
|
27 |
#include <peninputeventbutton.h>
|
|
28 |
#include <peninputdragbutton.h>
|
|
29 |
#include <peninputrepeatbutton.h>
|
|
30 |
#include <peninputmultimodebutton.h>
|
|
31 |
#include <peninputrangebar.h>
|
|
32 |
#include <peninputdataconverter.h>
|
|
33 |
#include <peninputdataprovider.h>
|
|
34 |
#include <peninputclientlayoutinfo.h>
|
|
35 |
#include <peninputlayoutchoicelist.h>
|
|
36 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
37 |
#include <peninputlayoutbubblectrl.h>
|
|
38 |
#include <peninputscrollablelist.h>
|
|
39 |
#include <e32keys.h>
|
|
40 |
#include <AknIconUtils.h>
|
|
41 |
#include <AknLayoutDef.h>
|
|
42 |
#include <AknUtils.h>
|
|
43 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
44 |
#include <AknsUtils.h>
|
|
45 |
#include <AknFepGlobalEnums.h>
|
|
46 |
#include <peninputlayoutinputmodechoice.h>
|
|
47 |
#include <peninputlayoutmultilineicf.h>
|
|
48 |
#include <s32mem.h>
|
|
49 |
|
|
50 |
// User includes
|
|
51 |
#include "peninputsplitqwerty.hrh"
|
|
52 |
#include "peninputsplitqwertywindow.h"
|
|
53 |
#include "peninputsplitqwertyenum.h"
|
|
54 |
#include "peninputrangebarinfo.h"
|
|
55 |
#include "peninputsplitqwertylafdatamgr.h"
|
|
56 |
#include "peninputsplitqwertylangmeritpair.h"
|
|
57 |
#include "peninputsplitqwertylayout.h"
|
|
58 |
|
|
59 |
#include <peninputaknvkbpreviewbubblerenderer.h>
|
|
60 |
#include <peninputlongpressbutton.h>
|
|
61 |
|
|
62 |
// Constants
|
|
63 |
const TInt KPeninputVkbWndInvalidIndex = -1;
|
|
64 |
const TInt KInvalidImg = -1 ;
|
|
65 |
const TInt KKeyCodeSize = 1;
|
|
66 |
const TInt KKeyDouble = 2;
|
|
67 |
|
|
68 |
_LIT( KVkbWindowResourceFile, "z:\\resource\\plugins\\peninputssqwin.rsc" );
|
|
69 |
_LIT( KConfigurationResourceFile, "z:\\resource\\plugins\\peninputssqwinconfiginfo_" );
|
|
70 |
_LIT( KResourceFileExtName, ".rsc" );
|
|
71 |
|
|
72 |
// ======== MEMBER FUNCTIONS ========
|
|
73 |
|
|
74 |
// ---------------------------------------------------------------------------
|
|
75 |
// Symbian constructor
|
|
76 |
// ---------------------------------------------------------------------------
|
|
77 |
//
|
|
78 |
CPeninputSplitQwertyWindow* CPeninputSplitQwertyWindow::NewL(
|
|
79 |
CFepUiLayout* aUiLayout,
|
|
80 |
MPeninputLayoutContext* aLayoutContext,
|
|
81 |
MPeninputUiStateMgr* aUiStateMgr )
|
|
82 |
{
|
|
83 |
CPeninputSplitQwertyWindow*
|
|
84 |
self = new ( ELeave ) CPeninputSplitQwertyWindow( aUiLayout,
|
|
85 |
aLayoutContext,
|
|
86 |
aUiStateMgr );
|
|
87 |
CleanupStack::PushL( self );
|
|
88 |
self->ConstructL();
|
|
89 |
CleanupStack::Pop( self );
|
|
90 |
|
|
91 |
return self;
|
|
92 |
}
|
|
93 |
|
|
94 |
// ---------------------------------------------------------------------------
|
|
95 |
// C++ destructor
|
|
96 |
// ---------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
CPeninputSplitQwertyWindow::~CPeninputSplitQwertyWindow()
|
|
99 |
{
|
|
100 |
delete iIdle;
|
|
101 |
iUnits.Close();
|
|
102 |
|
|
103 |
delete iLafMgr;
|
|
104 |
iLafMgr = NULL;
|
|
105 |
delete iBmpRotator;
|
|
106 |
|
|
107 |
iAccentCmdList.Close();
|
|
108 |
}
|
|
109 |
|
|
110 |
// ---------------------------------------------------------------------------
|
|
111 |
// Get id of window config resource
|
|
112 |
// ---------------------------------------------------------------------------
|
|
113 |
//
|
|
114 |
TInt CPeninputSplitQwertyWindow::GetWindowConfigResId()
|
|
115 |
{
|
|
116 |
return R_PENINPUT_LAYOUT_CONFIG_INFO;
|
|
117 |
}
|
|
118 |
|
|
119 |
// ---------------------------------------------------------------------------
|
|
120 |
// Get id of window resource
|
|
121 |
// ---------------------------------------------------------------------------
|
|
122 |
//
|
|
123 |
TInt CPeninputSplitQwertyWindow::GetWindowResId()
|
|
124 |
{
|
|
125 |
return R_PENINPUT_LAYOUT_FSQ_WINDOW_INFO;
|
|
126 |
}
|
|
127 |
|
|
128 |
// ---------------------------------------------------------------------------
|
|
129 |
// Get resource id of numeric keymapping
|
|
130 |
// ---------------------------------------------------------------------------
|
|
131 |
//
|
|
132 |
TInt CPeninputSplitQwertyWindow::GetNumKeymappingResId()
|
|
133 |
{
|
|
134 |
return R_PENINPUT_LAYOUT_KEY_MAPPING_STRING_LIST;
|
|
135 |
}
|
|
136 |
|
|
137 |
// ---------------------------------------------------------------------------
|
|
138 |
// Get file name of window config resource
|
|
139 |
// ---------------------------------------------------------------------------
|
|
140 |
//
|
|
141 |
const TDesC& CPeninputSplitQwertyWindow::GetWindowConfigResFileName( TInt aLangID )
|
|
142 |
{
|
|
143 |
if ( aLangID <= 0 )
|
|
144 |
{
|
|
145 |
return KNullDesC;
|
|
146 |
}
|
|
147 |
|
|
148 |
iResourceFilename.Zero();
|
|
149 |
// Generate resource file name according to language id
|
|
150 |
iResourceFilename = KConfigurationResourceFile();
|
|
151 |
|
|
152 |
if ( aLangID < 10 )
|
|
153 |
{
|
|
154 |
iResourceFilename.AppendNum( 0 );
|
|
155 |
iResourceFilename.AppendNum( aLangID );
|
|
156 |
}
|
|
157 |
else
|
|
158 |
{
|
|
159 |
iResourceFilename.AppendNum( aLangID );
|
|
160 |
}
|
|
161 |
iResourceFilename.Append( KResourceFileExtName );
|
|
162 |
|
|
163 |
return iResourceFilename;
|
|
164 |
}
|
|
165 |
|
|
166 |
// ---------------------------------------------------------------------------
|
|
167 |
// Get file name of window resource
|
|
168 |
// ---------------------------------------------------------------------------
|
|
169 |
//
|
|
170 |
const TDesC& CPeninputSplitQwertyWindow::GetWindowResFileName()
|
|
171 |
{
|
|
172 |
return KVkbWindowResourceFile();
|
|
173 |
}
|
|
174 |
|
|
175 |
// ---------------------------------------------------------------------------
|
|
176 |
// Change unit size
|
|
177 |
// ---------------------------------------------------------------------------
|
|
178 |
//
|
|
179 |
const TRect CPeninputSplitQwertyWindow::ChangeUnitSize()
|
|
180 |
{
|
|
181 |
return TRect();
|
|
182 |
}
|
|
183 |
|
|
184 |
// ---------------------------------------------------------------------------
|
|
185 |
// Change size of client area
|
|
186 |
// ---------------------------------------------------------------------------
|
|
187 |
//
|
|
188 |
void CPeninputSplitQwertyWindow::ChangeClientSize()
|
|
189 |
{
|
|
190 |
if ( !iPopupWnd->Hiden() )
|
|
191 |
{
|
|
192 |
iPopupWnd->CloseWindow();
|
|
193 |
iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby );
|
|
194 |
}
|
|
195 |
|
|
196 |
HandlePopupSizeChange();
|
|
197 |
|
|
198 |
TInt clientLayoutId = IntContext( EPeninputDataTypeClientLayout );
|
|
199 |
CPeninputClientLayoutInfo*
|
|
200 |
clientLayout = ConfigInfo()->FindClientLayoutInfo( clientLayoutId );
|
|
201 |
|
|
202 |
if ( clientLayout )
|
|
203 |
{
|
|
204 |
ReorganizeControls( clientLayout->LayoutID(), EFalse );
|
|
205 |
}
|
|
206 |
|
|
207 |
UpdateArea( iVkbCtrl->Rect(), EFalse );
|
|
208 |
}
|
|
209 |
|
|
210 |
// ---------------------------------------------------------------------------
|
|
211 |
// Construct all controls specified in resource
|
|
212 |
// ---------------------------------------------------------------------------
|
|
213 |
//
|
|
214 |
void CPeninputSplitQwertyWindow::CreateAllControlsL()
|
|
215 |
{
|
|
216 |
// Range bar
|
|
217 |
AddRangeBarL();
|
|
218 |
|
|
219 |
// Vkb control
|
|
220 |
iVkbCtrl = CPeninputVkbCtrlExt::NewL( TRect(),
|
|
221 |
UiLayout(),
|
|
222 |
EPeninutWindowCtrlIdVkbCtrl,
|
|
223 |
NULL );
|
|
224 |
|
|
225 |
iVkbCtrl->SetResourceId( R_PENINPUT_LAYOUT_VKB_KEYBOARD );
|
|
226 |
iVkbCtrl->ConstructFromResourceL();
|
|
227 |
iVkbCtrl->SetKeyTextColorGroup( EAknsCIQsnTextColorsCG68 );
|
|
228 |
iVkbLayout->SetVkbKeyboard( iVkbCtrl );
|
|
229 |
|
|
230 |
iVkbCtrl->SetIrregularKeyBoard( EFalse );
|
|
231 |
iVkbLayout->SetNonIrregularResourceId( R_AKN_FEP_VKB_NONIRREGULAR_BITMAP );
|
|
232 |
iVkbLayout->ConstructFromNonIrregularResourceL();
|
|
233 |
|
|
234 |
//todo split-view FSQ, bubble support
|
|
235 |
CPeninputAknVkbPreviewBubbleRenderer* renderer = CPeninputAknVkbPreviewBubbleRenderer::NewL();
|
|
236 |
iVkbCtrl->SetPreviewBubbleRenderer( renderer );
|
|
237 |
iVkbCtrl->ShowBubble( ETrue );
|
|
238 |
iVkbCtrl->SetGowithPointerDown( ETrue );
|
|
239 |
iVkbCtrl->SetBubbleBitmapParam( NULL, NULL, KAknsIIDQsnFrInputCharPreview );
|
|
240 |
iVkbCtrl->SetBubbleSize( TSize(80,80) ); //todo preview-bubble
|
|
241 |
|
|
242 |
//set key to be 9 piece graphics
|
|
243 |
iVkbCtrl->SetKeySkinId( EKeyBmpNormal, KAknsIIDQsnFrKeypadButtonFrNormal );
|
|
244 |
iVkbCtrl->SetKeySkinId( EKeyBmpHighlight, KAknsIIDQsnFrKeypadButtonFrPressed );
|
|
245 |
iVkbCtrl->SetKeySkinId( EKeyBmpDim, KAknsIIDQsnFrKeypadButtonFrInactive );
|
|
246 |
|
|
247 |
AddControlL( iVkbCtrl );
|
|
248 |
iVkbCtrl->AddEventObserver( UiLayout() );
|
|
249 |
|
|
250 |
AddButtonL( EPeninutWindowCtrlIdEnterBtn,
|
|
251 |
EPeninputLayoutEventEnter,
|
|
252 |
R_PENINPUT_LAYOUT_VKB_ENTER,
|
|
253 |
EKeyEnter );
|
|
254 |
|
|
255 |
// Shift and capslock merged button
|
|
256 |
|
|
257 |
CAknFepCtrlMultiModeButton* button = CAknFepCtrlMultiModeButton::NewLC(
|
|
258 |
UiLayout(),
|
|
259 |
EPeninutWindowCtrlIdShiftBtn );
|
|
260 |
if ( button )
|
|
261 |
{
|
|
262 |
// Read resource
|
|
263 |
TInt resid = R_PENINPUT_LAYOUT_VKB_SHIFT_CAPSLOCK;
|
|
264 |
TResourceReader reader;
|
|
265 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, resid );
|
|
266 |
button->SetResourceId( resid );
|
|
267 |
button->ConstructFromResourceL();
|
|
268 |
|
|
269 |
CleanupStack::PopAndDestroy( 1 ); //reader
|
|
270 |
|
|
271 |
AddControlL( button );
|
|
272 |
button->AddEventObserver( UiLayout() );
|
|
273 |
}
|
|
274 |
CleanupStack::Pop( button );
|
|
275 |
|
|
276 |
|
|
277 |
// Space button
|
|
278 |
CAknFepCtrlEventButton* spaceButton = EventButtonCtrl(
|
|
279 |
EPeninutWindowCtrlIdSpaceBtn );
|
|
280 |
|
|
281 |
// Create 3-pieces color icon for space button
|
|
282 |
CPenInput3PiecesColorIcons* colorIcons = NULL;
|
|
283 |
colorIcons = CPenInput3PiecesColorIcons::NewL( R_AKN_FEP_VKB_SPACE_ICON1,
|
|
284 |
R_AKN_FEP_VKB_SPACE_ICON2,
|
|
285 |
R_AKN_FEP_VKB_SPACE_ICON3 );
|
|
286 |
|
|
287 |
spaceButton->Set3PiecesColorIcons( colorIcons );
|
|
288 |
|
|
289 |
//set background of space button to be 9 piece graphics
|
|
290 |
spaceButton->SetImageFrameId( KAknsIIDQsnFrKeypadButtonFrNormal,
|
|
291 |
KAknsIIDQsnFrKeypadButtonFrPressed,
|
|
292 |
KAknsIIDQsnFrKeypadButtonFrInactive );
|
|
293 |
|
|
294 |
// Add popup window
|
|
295 |
AddPopupWindowL();
|
|
296 |
|
|
297 |
}
|
|
298 |
|
|
299 |
// ---------------------------------------------------------------------------
|
|
300 |
// Set control fonts. Fonts info comes from resource
|
|
301 |
// ---------------------------------------------------------------------------
|
|
302 |
//
|
|
303 |
void CPeninputSplitQwertyWindow::SetControlsFont()
|
|
304 |
{
|
|
305 |
}
|
|
306 |
|
|
307 |
// ---------------------------------------------------------------------------
|
|
308 |
// Pop up choice list
|
|
309 |
// ---------------------------------------------------------------------------
|
|
310 |
//
|
|
311 |
void CPeninputSplitQwertyWindow::PopupChoiceList()
|
|
312 |
{
|
|
313 |
TRAP_IGNORE( PopupRangeListL() );
|
|
314 |
}
|
|
315 |
|
|
316 |
// ---------------------------------------------------------------------------
|
|
317 |
// Re-organize all controls in the assigned client area layout
|
|
318 |
// ---------------------------------------------------------------------------
|
|
319 |
//
|
|
320 |
void CPeninputSplitQwertyWindow::ReorganizeControls( TInt aClientLayoutId,
|
|
321 |
TBool aNeedReset )
|
|
322 |
{
|
|
323 |
CPeninputClientLayoutInfo* clientLayout =
|
|
324 |
ConfigInfo()->FindClientLayoutInfo( aClientLayoutId );
|
|
325 |
RPointerArray<CPeninputControlInfo>& controlList =
|
|
326 |
clientLayout->ControlInfoList();
|
|
327 |
|
|
328 |
const TInt keyColumns = clientLayout->Columns();
|
|
329 |
const TInt keyRows = clientLayout->Rows();
|
|
330 |
|
|
331 |
if ( iLastUsedTotalColumns == keyColumns && iLastUsedTotalRows == keyRows )
|
|
332 |
{
|
|
333 |
return;
|
|
334 |
}
|
|
335 |
|
|
336 |
iLafMgr->SetLayoutType(
|
|
337 |
iLafMgr->LayoutTypeFromRowsColumns( keyRows, keyColumns )
|
|
338 |
);
|
|
339 |
|
|
340 |
iLastUsedTotalColumns = keyColumns;
|
|
341 |
iLastUsedTotalRows = keyRows;
|
|
342 |
|
|
343 |
TRect winRect( Rect().iTl, iLafMgr->EntirePaneRect().Size() );
|
|
344 |
SetWindowRect( winRect );
|
|
345 |
UiLayout()->LayoutOwner()->SetPosition( iLafMgr->EntirePaneRect().iTl );
|
|
346 |
|
|
347 |
ReorgnizeTitleBar();
|
|
348 |
|
|
349 |
const TInt count = controlList.Count();
|
|
350 |
TInt controlID = 0;
|
|
351 |
CFepUiBaseCtrl* ctrl = NULL;
|
|
352 |
TRect rect;
|
|
353 |
TRect inRect;
|
|
354 |
TRect exRect;
|
|
355 |
|
|
356 |
TPoint winPoint = Rect().iTl;
|
|
357 |
TPoint LafPoint = iLafMgr->EntirePaneRect().iTl;
|
|
358 |
|
|
359 |
for ( TInt i = 0; i < count; i++ )
|
|
360 |
{
|
|
361 |
controlID = controlList[i]->ControlID();
|
|
362 |
ctrl = Control( controlID );
|
|
363 |
|
|
364 |
if ( !ctrl )
|
|
365 |
{
|
|
366 |
continue;
|
|
367 |
}
|
|
368 |
|
|
369 |
AddNotOwnedControl( ctrl );
|
|
370 |
|
|
371 |
if ( ( ctrl->ControlType() | ECtrlButton ) == ECtrlButton )
|
|
372 |
{
|
|
373 |
|
|
374 |
iLafMgr->GetButtonRect(
|
|
375 |
TPeninputCommonCtrlID(ctrl->ControlId() ),
|
|
376 |
exRect, inRect );
|
|
377 |
|
|
378 |
if( controlID == EPeninutWindowCtrlIdShiftBtn)
|
|
379 |
{
|
|
380 |
CAknFepCtrlMultiModeButton* btn = NULL;
|
|
381 |
btn = static_cast<CAknFepCtrlMultiModeButton*>(ctrl);
|
|
382 |
btn->SizeChanged( exRect, inRect, ETrue );
|
|
383 |
}
|
|
384 |
else
|
|
385 |
{
|
|
386 |
CAknFepCtrlCommonButton* btn = NULL;
|
|
387 |
btn = static_cast<CAknFepCtrlCommonButton*>(ctrl);
|
|
388 |
|
|
389 |
if ( ctrl->ControlId() == EPeninutWindowCtrlIdSpaceBtn )
|
|
390 |
{
|
|
391 |
// config 3 pieces icon info
|
|
392 |
TRect frameRect, middleRect;
|
|
393 |
iLafMgr->GetSpaceButtonExLayoutInfo( frameRect, middleRect );
|
|
394 |
inRect = frameRect;
|
|
395 |
|
|
396 |
TDraw3PiecesFrame pic3frame(
|
|
397 |
KAknsIIDQgnIndiInputSpaceL,
|
|
398 |
KAknsIIDQgnIndiInputSpaceMiddle,
|
|
399 |
KAknsIIDQgnIndiInputSpaceR,
|
|
400 |
middleRect);
|
|
401 |
|
|
402 |
btn->SetDraw3PieceFrameInfo( pic3frame );
|
|
403 |
}
|
|
404 |
|
|
405 |
btn->SizeChanged( exRect, inRect, ETrue );
|
|
406 |
}
|
|
407 |
}
|
|
408 |
|
|
409 |
else if ( ctrl->ControlId() == EPeninutWindowCtrlIdVkbCtrl )
|
|
410 |
{
|
|
411 |
iVkbCtrl->SetFont( iLafMgr->KeyTextFont() );
|
|
412 |
iVkbCtrl->SetTextLineLayout( iLafMgr->KeyTextLayout() );
|
|
413 |
iVkbCtrl->SetTextFormat( iLafMgr->PreviewWndText() ); //Read laf
|
|
414 |
if ( aNeedReset )
|
|
415 |
{
|
|
416 |
iVkbCtrl->Reset();
|
|
417 |
}
|
|
418 |
|
|
419 |
rect = iLafMgr->KeypadRect();
|
|
420 |
CPeninputVkbCtrlExt* ctrlext = static_cast<CPeninputVkbCtrlExt*>(ctrl);
|
|
421 |
ctrlext->SizeChanged(rect);
|
|
422 |
}
|
|
423 |
}
|
|
424 |
}
|
|
425 |
|
|
426 |
// ---------------------------------------------------------------------------
|
|
427 |
// Do when case changed
|
|
428 |
// ---------------------------------------------------------------------------
|
|
429 |
//
|
|
430 |
void CPeninputSplitQwertyWindow::DoCaseChange( TInt aNewCase )
|
|
431 |
{
|
|
432 |
TInt curCase = IntContext( EPeninputDataTypeCase );
|
|
433 |
|
|
434 |
if ( aNewCase == curCase )
|
|
435 |
{
|
|
436 |
return;
|
|
437 |
}
|
|
438 |
|
|
439 |
TInt curRange = IntContext( EPeninputDataTypeCurrentRange );
|
|
440 |
|
|
441 |
if ( ( curRange == ERangeEnglish )
|
|
442 |
|| ( curRange == ERangeAccent )
|
|
443 |
|| ( curRange == ERangeNative && ConfigInfo()->CaseSensitive() )
|
|
444 |
)
|
|
445 |
{
|
|
446 |
// Set shift and caplock button
|
|
447 |
TInt shfit;
|
|
448 |
TInt capslock;
|
|
449 |
|
|
450 |
CPeninputDataConverter::ShiftCapslockByCase( aNewCase, shfit, capslock );
|
|
451 |
|
|
452 |
iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shfit );
|
|
453 |
iLayoutContext->SetData( EPeninputDataTypeCapslockDown, &capslock );
|
|
454 |
iLayoutContext->SetData( EPeninputDataTypeCase, &aNewCase );
|
|
455 |
ChangeMergedButtonStatus( shfit, capslock );
|
|
456 |
|
|
457 |
TInt vkblayout = ConfigInfo()->ShiftCapsSingleVkbLayoutByCase( curRange,
|
|
458 |
aNewCase );
|
|
459 |
|
|
460 |
if ( curRange == ERangeAccent )
|
|
461 |
{
|
|
462 |
TInt curAccentIndex = IntContext( EPeninputDataTypeCurrentAccent );
|
|
463 |
vkblayout = vkblayout + curAccentIndex * 2;
|
|
464 |
}
|
|
465 |
|
|
466 |
ChangeVkbLayout( vkblayout );
|
|
467 |
}
|
|
468 |
}
|
|
469 |
|
|
470 |
// ---------------------------------------------------------------------------
|
|
471 |
// Handle control event
|
|
472 |
// ---------------------------------------------------------------------------
|
|
473 |
//
|
|
474 |
void CPeninputSplitQwertyWindow::HandleControlEvent( TInt aEventType,
|
|
475 |
CFepUiBaseCtrl* aCtrl,
|
|
476 |
const TDesC& aEventData )
|
|
477 |
{
|
|
478 |
// Call this function in base class
|
|
479 |
CPeninputLayoutWindowExt::HandleControlEvent( aEventType, aCtrl,
|
|
480 |
aEventData );
|
|
481 |
|
|
482 |
TInt* data = (TInt*) aEventData.Ptr();
|
|
483 |
TInt ctrlId = aCtrl ? aCtrl->ControlId() : -1;
|
|
484 |
|
|
485 |
switch ( aEventType )
|
|
486 |
{
|
|
487 |
case EPeninputLayoutEventMultiRangeLongPress:
|
|
488 |
{
|
|
489 |
if ( ctrlId == EPeninutWindowCtrlIdRangeBtn )
|
|
490 |
{
|
|
491 |
// Before pop up list, cancel down event, and set range button un-highlight.
|
|
492 |
TRAP_IGNORE( aCtrl->CancelPointerDownL());
|
|
493 |
static_cast<CAknFepCtrlCommonButton*>(aCtrl)->SetHighlight( EFalse );
|
|
494 |
PopupChoiceList();
|
|
495 |
}
|
|
496 |
}
|
|
497 |
break;
|
|
498 |
case EPeninputLayoutEventMultiRange:
|
|
499 |
{
|
|
500 |
if ( ctrlId == EPeninutWindowCtrlIdRangeBtn )
|
|
501 |
{
|
|
502 |
if ( iHandleRangeShortPress )
|
|
503 |
{
|
|
504 |
HandleRangeButtonShortPress();
|
|
505 |
}
|
|
506 |
}
|
|
507 |
|
|
508 |
iHandleRangeShortPress = ETrue;
|
|
509 |
}
|
|
510 |
break;
|
|
511 |
case EPeninputLayoutVkbEventResetShift:
|
|
512 |
{
|
|
513 |
HandleShiftAndCapslockBtnClicked();
|
|
514 |
}
|
|
515 |
break;
|
|
516 |
case EPenInputLayoutEventClosePopup:
|
|
517 |
{
|
|
518 |
if ( iPopupWnd && !iPopupWnd->Hiden() )
|
|
519 |
{
|
|
520 |
iPopupWnd->CloseWindow();
|
|
521 |
iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby );
|
|
522 |
}
|
|
523 |
}
|
|
524 |
break;
|
|
525 |
case EEventChoiceSelected:
|
|
526 |
{
|
|
527 |
CFepUiBaseCtrl* btn = Control( EPeninutWindowCtrlIdRangeBtn );
|
|
528 |
|
|
529 |
if ( btn )
|
|
530 |
{
|
|
531 |
iHandleRangeShortPress = EFalse;
|
|
532 |
TRAP_IGNORE( btn->HandlePointerUpEventL( btn->Rect().iBr ) );
|
|
533 |
iHandleRangeShortPress = ETrue;
|
|
534 |
}
|
|
535 |
CFepLayoutChoiceList::SEvent* event = NULL;
|
|
536 |
event = (CFepLayoutChoiceList::SEvent*) aEventData.Ptr();
|
|
537 |
|
|
538 |
if ( event->iIndex != KPeninputVkbWndInvalidIndex )
|
|
539 |
{
|
|
540 |
if ( ctrlId == EPeninutWindowCtrlIdAccentPopupWindow )
|
|
541 |
{
|
|
542 |
TRAP_IGNORE( HandleRangeListSelectedL( aCtrl, aEventData ) );
|
|
543 |
}
|
|
544 |
}
|
|
545 |
iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby );
|
|
546 |
}
|
|
547 |
break;
|
|
548 |
case EEventVirtualKeyLatched:
|
|
549 |
{
|
|
550 |
HandleVirtualKeyLatchedEvent( aEventType, aCtrl, aEventData );
|
|
551 |
}
|
|
552 |
break;
|
|
553 |
case EEventVirtualKeyUnLatched:
|
|
554 |
{
|
|
555 |
// Sumbit Deadkey
|
|
556 |
TRAP_IGNORE( SubmitDeadKeyL( iNewDeadKeyBuf ) );
|
|
557 |
|
|
558 |
TBool deadKeyChange = EFalse;
|
|
559 |
iLayoutContext->SetData( EAkninputDataTypeLatchedSet, &deadKeyChange );
|
|
560 |
iNewDeadKeyBuf = KNullDesC;
|
|
561 |
}
|
|
562 |
break;
|
|
563 |
case EPeninputLayoutEventBack:
|
|
564 |
{
|
|
565 |
TInt latchedFlag = IntContext( EAkninputDataTypeLatchedSet );
|
|
566 |
// If one DeadKey is latched,
|
|
567 |
// only unlatch the DeadKey and reset the iNewDeadKeyBuf
|
|
568 |
// Don't delete the visible charater in ICF
|
|
569 |
if ( latchedFlag )
|
|
570 |
{
|
|
571 |
UnLatchDeadKey(iNewDeadKeyBuf);
|
|
572 |
|
|
573 |
TBool deadKeyChange = EFalse;
|
|
574 |
iLayoutContext->SetData( EAkninputDataTypeLatchedSet, &deadKeyChange );
|
|
575 |
iNewDeadKeyBuf = KNullDesC;
|
|
576 |
}
|
|
577 |
}
|
|
578 |
break;
|
|
579 |
case EPeninputLayoutEventEnter:
|
|
580 |
case EPeninputLayoutEventSpace:
|
|
581 |
{
|
|
582 |
TInt latchedFlag = IntContext( EAkninputDataTypeLatchedSet );
|
|
583 |
if ( latchedFlag )
|
|
584 |
{
|
|
585 |
HBufC* newCharBuf = HBufC::New( KKeyDouble * iNewDeadKeyBuf.Length()
|
|
586 |
+ aEventData.Length() );
|
|
587 |
if( newCharBuf )
|
|
588 |
{
|
|
589 |
CPeninputSplitQwertyLayout* layout
|
|
590 |
= static_cast<CPeninputSplitQwertyLayout*>( UiLayout() );
|
|
591 |
if( layout->IsEnableITI() )
|
|
592 |
{
|
|
593 |
// If ITI is open, double same keys should be send for one dead key,
|
|
594 |
// core will handle them as one key.
|
|
595 |
newCharBuf->Des().Append( iNewDeadKeyBuf );
|
|
596 |
}
|
|
597 |
newCharBuf->Des().Append( iNewDeadKeyBuf );
|
|
598 |
newCharBuf->Des().Append( aEventData );
|
|
599 |
}
|
|
600 |
|
|
601 |
UnLatchDeadKey( iNewDeadKeyBuf );
|
|
602 |
|
|
603 |
TBool deadKeyChange = EFalse;
|
|
604 |
iLayoutContext->SetData( EAkninputDataTypeLatchedSet, &deadKeyChange );
|
|
605 |
|
|
606 |
// Submit DeadKey + Space or Enter at the same time
|
|
607 |
|
|
608 |
if( newCharBuf != NULL )
|
|
609 |
{
|
|
610 |
UiLayout()->SignalOwner( ESignalKeyEvent, *newCharBuf );
|
|
611 |
}
|
|
612 |
iNewDeadKeyBuf = KNullDesC;
|
|
613 |
delete newCharBuf;
|
|
614 |
newCharBuf = NULL;
|
|
615 |
}
|
|
616 |
}
|
|
617 |
break;
|
|
618 |
default:
|
|
619 |
break;
|
|
620 |
}
|
|
621 |
}
|
|
622 |
|
|
623 |
// ---------------------------------------------------------------------------
|
|
624 |
// load settings from resource
|
|
625 |
// ---------------------------------------------------------------------------
|
|
626 |
//
|
|
627 |
void CPeninputSplitQwertyWindow::ConstructFromResourceL()
|
|
628 |
{
|
|
629 |
CPeninputLayoutWindowExt::ConstructFromResourceL();
|
|
630 |
if ( iVkbLayout && !iFirstConstruct )
|
|
631 |
{
|
|
632 |
if ( iVkbCtrl->IsIrregularKeyBoard() )
|
|
633 |
{
|
|
634 |
iVkbLayout->ConstructFromIrregularResourceL();
|
|
635 |
}
|
|
636 |
else
|
|
637 |
{
|
|
638 |
iVkbLayout->ConstructFromNonIrregularResourceL();
|
|
639 |
}
|
|
640 |
|
|
641 |
SetVkbLayoutSize();
|
|
642 |
|
|
643 |
if ( IsRtoLLanguage( iLanguage ) )
|
|
644 |
{
|
|
645 |
//Mirror backspace graphic
|
|
646 |
HandleButtonResOnLangDirChange( EPeninutWindowCtrlIdBackspaceBtn );
|
|
647 |
}
|
|
648 |
}
|
|
649 |
|
|
650 |
iFirstConstruct = EFalse;
|
|
651 |
iHandleRangeShortPress = ETrue;
|
|
652 |
}
|
|
653 |
|
|
654 |
// ---------------------------------------------------------------------------
|
|
655 |
// Callback function to do background construction
|
|
656 |
// ---------------------------------------------------------------------------
|
|
657 |
//
|
|
658 |
TInt CPeninputSplitQwertyWindow::BackgroundTaskL( TAny* aPtr )
|
|
659 |
{
|
|
660 |
CPeninputSplitQwertyWindow* self = static_cast<CPeninputSplitQwertyWindow*>(aPtr);
|
|
661 |
self->DoIdleConstructL();
|
|
662 |
return EFalse; // only run once
|
|
663 |
}
|
|
664 |
|
|
665 |
// ---------------------------------------------------------------------------
|
|
666 |
// Set current language
|
|
667 |
// ---------------------------------------------------------------------------
|
|
668 |
//
|
|
669 |
void CPeninputSplitQwertyWindow::SetSwitchlistLanguage(TInt aLang)
|
|
670 |
{
|
|
671 |
ASSERT( IsValidLanguage( aLang ) );
|
|
672 |
|
|
673 |
//Check language input direction change
|
|
674 |
TBool isLangDirectionChange = EFalse;
|
|
675 |
if ( IsValidLanguage( iLanguage ) )
|
|
676 |
{
|
|
677 |
isLangDirectionChange = IsRtoLLanguage( aLang ) ^ IsRtoLLanguage( iLanguage );
|
|
678 |
}
|
|
679 |
else
|
|
680 |
{
|
|
681 |
isLangDirectionChange = IsRtoLLanguage( aLang );
|
|
682 |
}
|
|
683 |
|
|
684 |
TPeninputVkbLafOption option = iLafMgr->OptionType();
|
|
685 |
if ( aLang ==ELangHebrew || aLang == ELangGreek || aLang == ELangHindi
|
|
686 |
|| aLang == ELangMarathi )
|
|
687 |
{
|
|
688 |
option = (TPeninputVkbLafOption)( option & ( ~EOption3CellRange ) );
|
|
689 |
iLafMgr->SetLafOption( option );
|
|
690 |
}
|
|
691 |
else
|
|
692 |
{
|
|
693 |
option = (TPeninputVkbLafOption)( option | EOption3CellRange );
|
|
694 |
iLafMgr->SetLafOption( option );
|
|
695 |
}
|
|
696 |
|
|
697 |
if( isLangDirectionChange )
|
|
698 |
{
|
|
699 |
//Mirror backspace graphic
|
|
700 |
HandleButtonResOnLangDirChange( EPeninutWindowCtrlIdBackspaceBtn );
|
|
701 |
}
|
|
702 |
|
|
703 |
iLanguage = aLang;
|
|
704 |
}
|
|
705 |
|
|
706 |
// ---------------------------------------------------------------------------
|
|
707 |
// Set current editor is secret
|
|
708 |
// ---------------------------------------------------------------------------
|
|
709 |
//
|
|
710 |
void CPeninputSplitQwertyWindow::SetSwitchlistSecretFlag( TBool aSecret )
|
|
711 |
{
|
|
712 |
CFepUiBaseCtrl* ctrl = Control( EPeninutWindowCtrlIdSwitcherPopupWindow );
|
|
713 |
CPeninputLayoutInputmodelChoice* choice =
|
|
714 |
static_cast<CPeninputLayoutInputmodelChoice*>( ctrl );
|
|
715 |
if ( choice )
|
|
716 |
{
|
|
717 |
choice->SetSecretEditor( aSecret );
|
|
718 |
}
|
|
719 |
//disable or enable arrow keys of FSQ in secret editor.
|
|
720 |
}
|
|
721 |
|
|
722 |
// ---------------------------------------------------------------------------
|
|
723 |
// Dim the arrow keys on qwerty when the editor is findpane or secret editor
|
|
724 |
// ---------------------------------------------------------------------------
|
|
725 |
//
|
|
726 |
void CPeninputSplitQwertyWindow::DimArrowKeys( TBool aDimArrow )
|
|
727 |
{
|
|
728 |
if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ
|
|
729 |
&& iArrowLeftButton && iArrowRightButton )
|
|
730 |
{
|
|
731 |
iArrowLeftButton->SetDimmed( aDimArrow );
|
|
732 |
iArrowRightButton->SetDimmed( aDimArrow );
|
|
733 |
}
|
|
734 |
}
|
|
735 |
|
|
736 |
// ---------------------------------------------------------------------------
|
|
737 |
// Handle accented char event
|
|
738 |
// ---------------------------------------------------------------------------
|
|
739 |
//
|
|
740 |
TBool CPeninputSplitQwertyWindow::HandleAccentCharEvent( TInt /*aEventType*/,
|
|
741 |
const TDesC& aEventData,
|
|
742 |
const TDesC& aDeadKey,
|
|
743 |
HBufC* anewCharBuf )
|
|
744 |
{
|
|
745 |
// Get the unicode of virtual key char
|
|
746 |
TBuf<16> buf;
|
|
747 |
TKeyEvent* event = (TKeyEvent*) aEventData.Ptr();
|
|
748 |
buf.Append( event->iCode );
|
|
749 |
TBool rs = EFalse;
|
|
750 |
|
|
751 |
// Caculate the accent char number
|
|
752 |
TInt count = sizeof(KSupportLanguages)/sizeof(TLangMeritPair);
|
|
753 |
|
|
754 |
if ( aDeadKey.Compare( KNullDesC ) != 0 ) // One DeadKey is latched
|
|
755 |
{
|
|
756 |
for ( TInt i = 0; i < count; i++ )
|
|
757 |
{
|
|
758 |
if ( ( aDeadKey[0] == KSupportLanguages[i].iDeadKey ) &&
|
|
759 |
( buf[0] == KSupportLanguages[i].iChar) )
|
|
760 |
{
|
|
761 |
if ( anewCharBuf )
|
|
762 |
{
|
|
763 |
anewCharBuf->Des().Append( KSupportLanguages[i].iAccentedChar );
|
|
764 |
rs = ETrue;
|
|
765 |
}
|
|
766 |
break;
|
|
767 |
}
|
|
768 |
}
|
|
769 |
}
|
|
770 |
return rs;
|
|
771 |
}
|
|
772 |
|
|
773 |
// ---------------------------------------------------------------------------
|
|
774 |
// Handle virtual key latched event
|
|
775 |
// ---------------------------------------------------------------------------
|
|
776 |
//
|
|
777 |
void CPeninputSplitQwertyWindow::HandleVirtualKeyLatchedEvent(TInt /*aEventType*/,
|
|
778 |
CFepUiBaseCtrl* /*aCtrl*/,
|
|
779 |
const TDesC& aEventData )
|
|
780 |
{
|
|
781 |
TBuf<16> deadKey(KNullDesC);
|
|
782 |
TKeyEvent* event = (TKeyEvent*) aEventData.Ptr();
|
|
783 |
deadKey.Append(event->iCode);
|
|
784 |
|
|
785 |
TInt latchedFlag = IntContext( EAkninputDataTypeLatchedSet );
|
|
786 |
if ( latchedFlag )
|
|
787 |
{
|
|
788 |
// Update the new and old DeadKey buffer
|
|
789 |
iOldDeadKeyBuf = iNewDeadKeyBuf;
|
|
790 |
iNewDeadKeyBuf = deadKey;
|
|
791 |
|
|
792 |
// Submit old Deadkey
|
|
793 |
TRAP_IGNORE( SubmitDeadKeyL( iOldDeadKeyBuf ) );
|
|
794 |
|
|
795 |
// Unlatch the previous DeadKey
|
|
796 |
UnLatchDeadKey( iOldDeadKeyBuf );
|
|
797 |
}
|
|
798 |
else
|
|
799 |
{
|
|
800 |
iNewDeadKeyBuf = deadKey;
|
|
801 |
|
|
802 |
// Set DeadKey state to latched
|
|
803 |
TBool deadKeyChange = ETrue;
|
|
804 |
iLayoutContext->SetData( EAkninputDataTypeLatchedSet, &deadKeyChange );
|
|
805 |
}
|
|
806 |
|
|
807 |
// Send the char to FEP
|
|
808 |
// Not submit the DeadKey when latch it.
|
|
809 |
// UiLayout()->SignalOwner( ESignalKeyEvent, iNewDeadKeyBuf );
|
|
810 |
}
|
|
811 |
|
|
812 |
// ---------------------------------------------------------------------------
|
|
813 |
// Submit dead key
|
|
814 |
// ---------------------------------------------------------------------------
|
|
815 |
//
|
|
816 |
void CPeninputSplitQwertyWindow::SubmitDeadKeyL( const TDesC& abuf )
|
|
817 |
{
|
|
818 |
HBufC* newCharBuf = HBufC::NewL( KKeyDouble * abuf.Length() );
|
|
819 |
if( newCharBuf )
|
|
820 |
{
|
|
821 |
CPeninputSplitQwertyLayout* layout
|
|
822 |
= static_cast<CPeninputSplitQwertyLayout*>( UiLayout() );
|
|
823 |
if( layout->IsEnableITI() )
|
|
824 |
{
|
|
825 |
// If ITI is open, double same keys should be send for one dead key,
|
|
826 |
// core will handle them as one key.
|
|
827 |
newCharBuf->Des().Append( abuf );
|
|
828 |
}
|
|
829 |
newCharBuf->Des().Append( abuf );
|
|
830 |
|
|
831 |
// Submit DeadKey
|
|
832 |
UiLayout()->SignalOwner( ESignalKeyEvent, *newCharBuf );
|
|
833 |
delete newCharBuf;
|
|
834 |
newCharBuf = NULL;
|
|
835 |
}
|
|
836 |
}
|
|
837 |
// ---------------------------------------------------------------------------
|
|
838 |
// Handle virtual key up event
|
|
839 |
// ---------------------------------------------------------------------------
|
|
840 |
//
|
|
841 |
TBool CPeninputSplitQwertyWindow::HandleVirtualKeyUpEvent(TInt aEventType,
|
|
842 |
CFepUiBaseCtrl* /*aCtrl*/,
|
|
843 |
const TDesC& aEventData )
|
|
844 |
{
|
|
845 |
// Get DeadKey state
|
|
846 |
TInt latchedFlag = IntContext( EAkninputDataTypeLatchedSet );
|
|
847 |
if ( latchedFlag )
|
|
848 |
{
|
|
849 |
TBool ret = EFalse;
|
|
850 |
|
|
851 |
TRAP_IGNORE( ret = HandleDeadKeyL( aEventType, aEventData ) );
|
|
852 |
|
|
853 |
if ( ret )
|
|
854 |
{
|
|
855 |
return ETrue;
|
|
856 |
}
|
|
857 |
else
|
|
858 |
{
|
|
859 |
// When the DeadKey can not combine with current character,
|
|
860 |
// Sumit current DeadKey
|
|
861 |
UiLayout()->SignalOwner( ESignalKeyEvent, iNewDeadKeyBuf );
|
|
862 |
}
|
|
863 |
}
|
|
864 |
|
|
865 |
iNewDeadKeyBuf = KNullDesC;
|
|
866 |
return EFalse;
|
|
867 |
}
|
|
868 |
|
|
869 |
// ---------------------------------------------------------------------------
|
|
870 |
// Set dead key
|
|
871 |
// ---------------------------------------------------------------------------
|
|
872 |
//
|
|
873 |
void CPeninputSplitQwertyWindow::SetDeadKey()
|
|
874 |
{
|
|
875 |
// Get VKB list
|
|
876 |
RPointerArray<CPeninputVkbLayoutInfo> vkbListInfo;
|
|
877 |
vkbListInfo = iVkbLayout->VkbLayoutInfoList();
|
|
878 |
TInt vkbListNum = vkbListInfo.Count();
|
|
879 |
|
|
880 |
CPeninputVkbKeyInfo* keyinfo;
|
|
881 |
TInt count = sizeof(KSupportLanguages)/sizeof(TLangMeritPair);
|
|
882 |
for ( TInt i = 0; i < vkbListNum; i++ )
|
|
883 |
{
|
|
884 |
for ( TInt j = 0; j < count; j++ )
|
|
885 |
{
|
|
886 |
if ( vkbListInfo[i]->LayoutID() == EPeninputVkbLayoutNativeChar ||
|
|
887 |
vkbListInfo[i]->LayoutID() == EPeninputVkbLayoutNativeCharShift )
|
|
888 |
{
|
|
889 |
keyinfo = vkbListInfo[i]->FindKey( KSupportLanguages[j].iDeadKey );
|
|
890 |
if ( keyinfo )
|
|
891 |
{
|
|
892 |
// Set the DeadKey as a latch button
|
|
893 |
CVirtualKey* key = keyinfo->Key();
|
|
894 |
key->SetLatchKey( ETrue );
|
|
895 |
}
|
|
896 |
}
|
|
897 |
}
|
|
898 |
}
|
|
899 |
}
|
|
900 |
|
|
901 |
|
|
902 |
// ---------------------------------------------------------------------------
|
|
903 |
// Unlatch a DeadKey by the key buffer
|
|
904 |
// ---------------------------------------------------------------------------
|
|
905 |
//
|
|
906 |
void CPeninputSplitQwertyWindow::UnLatchDeadKey( const TDesC& abuf )
|
|
907 |
{
|
|
908 |
RPointerArray<CPeninputVkbLayoutInfo> vkbListInfo;
|
|
909 |
vkbListInfo = iVkbLayout->VkbLayoutInfoList();
|
|
910 |
TInt vkbListNum = vkbListInfo.Count();
|
|
911 |
|
|
912 |
CPeninputVkbKeyInfo* keyinfo;
|
|
913 |
TInt count = sizeof(KSupportLanguages)/sizeof(TLangMeritPair);
|
|
914 |
for ( TInt i = 0; i < vkbListNum; i++ )
|
|
915 |
{
|
|
916 |
for ( TInt j = 0; j < count; j++ )
|
|
917 |
{
|
|
918 |
// Only NativeChar and NativeCharShift layout contain DeadKey
|
|
919 |
if(vkbListInfo[i]->LayoutID() == EPeninputVkbLayoutNativeChar ||
|
|
920 |
vkbListInfo[i]->LayoutID() == EPeninputVkbLayoutNativeCharShift)
|
|
921 |
{
|
|
922 |
// Find the DeadKey in NativeChar or NativeCharShift layout
|
|
923 |
keyinfo = vkbListInfo[i]->FindKey( KSupportLanguages[j].iDeadKey );
|
|
924 |
if ( keyinfo )
|
|
925 |
{
|
|
926 |
CVirtualKey* key = keyinfo->Key();
|
|
927 |
if ( key->Latched() )
|
|
928 |
{
|
|
929 |
if ( abuf == KNullDesC )
|
|
930 |
{
|
|
931 |
// When focus change, the latched key will be released
|
|
932 |
TBool deadKeyChange = EFalse;
|
|
933 |
iLayoutContext->SetData( EAkninputDataTypeLatchedSet,
|
|
934 |
&deadKeyChange );
|
|
935 |
key->SetLatched( EFalse );
|
|
936 |
TRect rect = key->Rect();
|
|
937 |
rect.Move( iVkbCtrl->Rect().iTl );
|
|
938 |
UpdateArea( rect, EFalse );
|
|
939 |
return;
|
|
940 |
}
|
|
941 |
if ( abuf[0] == KSupportLanguages[j].iDeadKey )
|
|
942 |
{
|
|
943 |
// When another DeadKey is clicked, the old one will be released
|
|
944 |
key->SetLatched( EFalse );
|
|
945 |
TRect rect = key->Rect();
|
|
946 |
rect.Move( iVkbCtrl->Rect().iTl );
|
|
947 |
UpdateArea( rect, EFalse );
|
|
948 |
return;
|
|
949 |
}
|
|
950 |
}
|
|
951 |
}
|
|
952 |
}
|
|
953 |
}
|
|
954 |
}
|
|
955 |
}
|
|
956 |
|
|
957 |
// ---------------------------------------------------------------------------
|
|
958 |
// Update laf data
|
|
959 |
// ---------------------------------------------------------------------------
|
|
960 |
//
|
|
961 |
void CPeninputSplitQwertyWindow::UpdateLafData()
|
|
962 |
{
|
|
963 |
TRAP_IGNORE( iLafMgr->UpdateLafDataL() );
|
|
964 |
}
|
|
965 |
|
|
966 |
// ---------------------------------------------------------------------------
|
|
967 |
// Load accent labels for range list
|
|
968 |
// ---------------------------------------------------------------------------
|
|
969 |
//
|
|
970 |
void CPeninputSplitQwertyWindow::ConstructAccentListL( TInt aLangId )
|
|
971 |
{
|
|
972 |
iAccentCmdList.Reset();
|
|
973 |
|
|
974 |
TBool is10x3 = ( aLangId == ELangEnglish ) || ( aLangId == ELangAmerican )
|
|
975 |
|| ( aLangId == ELangDutch) || (aLangId == ELangTagalog )
|
|
976 |
|| ( aLangId == ELangIndonesian) || (aLangId == ELangMalay );
|
|
977 |
|
|
978 |
if ( aLangId == ELangVietnamese )
|
|
979 |
{
|
|
980 |
_LIT( KVietAccentList1, "\x00E0 - \x013A" );
|
|
981 |
_LIT( KVietAccentList2, "\x013C - \x017E" );
|
|
982 |
|
|
983 |
CFepLayoutChoiceList::SItem item;
|
|
984 |
|
|
985 |
item.iCommand = EPeninputVkbLayoutAccented1;
|
|
986 |
item.iText.Copy( KVietAccentList1 );
|
|
987 |
iAccentCmdList.Append( item );
|
|
988 |
|
|
989 |
item.iCommand = EPeninputVkbLayoutAccented2;
|
|
990 |
item.iText.Copy( KVietAccentList2 );
|
|
991 |
iAccentCmdList.Append( item );
|
|
992 |
}
|
|
993 |
else if( aLangId == ELangRussian || aLangId == ELangUkrainian || aLangId == ELangBulgarian )
|
|
994 |
{
|
|
995 |
_LIT( KCyrillicAccent, "\x00E0 - \x017E" );
|
|
996 |
|
|
997 |
CFepLayoutChoiceList::SItem item;
|
|
998 |
|
|
999 |
item.iCommand = EPeninputVkbLayoutAccented1;
|
|
1000 |
item.iText.Copy( KCyrillicAccent );
|
|
1001 |
iAccentCmdList.Append( item );
|
|
1002 |
}
|
|
1003 |
// 10X3
|
|
1004 |
else if ( is10x3 )
|
|
1005 |
{
|
|
1006 |
_LIT( KVietAccentList1, "\x00E0 - \x0121" );
|
|
1007 |
_LIT( KVietAccentList2, "\x0123 - \x014F" );
|
|
1008 |
_LIT( KVietAccentList3, "\x0151 - \x017E" );
|
|
1009 |
|
|
1010 |
CFepLayoutChoiceList::SItem item;
|
|
1011 |
|
|
1012 |
item.iCommand = EPeninputVkbLayoutAccented1;
|
|
1013 |
item.iText.Copy( KVietAccentList1 );
|
|
1014 |
iAccentCmdList.Append( item );
|
|
1015 |
|
|
1016 |
item.iCommand = EPeninputVkbLayoutAccented2;
|
|
1017 |
item.iText.Copy( KVietAccentList2 );
|
|
1018 |
iAccentCmdList.Append( item );
|
|
1019 |
|
|
1020 |
|
|
1021 |
item.iCommand = EPeninputVkbLayoutAccented3;
|
|
1022 |
item.iText.Copy( KVietAccentList3 );
|
|
1023 |
iAccentCmdList.Append( item );
|
|
1024 |
}
|
|
1025 |
//10X4
|
|
1026 |
else
|
|
1027 |
{
|
|
1028 |
// Add item
|
|
1029 |
TResourceReader reader;
|
|
1030 |
CFepLayoutChoiceList::SItem item;
|
|
1031 |
|
|
1032 |
item.iCommand = EPeninputVkbLayoutAccented1;
|
|
1033 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT1 );
|
|
1034 |
TPtrC p1 = reader.ReadTPtrC();
|
|
1035 |
item.iText.Copy( p1 );
|
|
1036 |
iAccentCmdList.Append( item );
|
|
1037 |
CleanupStack::PopAndDestroy( 1 ); //reader
|
|
1038 |
|
|
1039 |
item.iCommand = EPeninputVkbLayoutAccented2;
|
|
1040 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT2 );
|
|
1041 |
TPtrC p2 = reader.ReadTPtrC();
|
|
1042 |
item.iText.Copy( p2 );
|
|
1043 |
iAccentCmdList.Append( item );
|
|
1044 |
CleanupStack::PopAndDestroy( 1 ); //reader
|
|
1045 |
|
|
1046 |
item.iCommand = EPeninputVkbLayoutAccented3;
|
|
1047 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT3 );
|
|
1048 |
TPtrC p3 = reader.ReadTPtrC();
|
|
1049 |
item.iText.Copy( p3 );
|
|
1050 |
iAccentCmdList.Append( item );
|
|
1051 |
CleanupStack::PopAndDestroy( 1 );//reader
|
|
1052 |
}
|
|
1053 |
|
|
1054 |
iPopupInited = ETrue;
|
|
1055 |
iPopupSet = ETrue;
|
|
1056 |
}
|
|
1057 |
|
|
1058 |
// ---------------------------------------------------------------------------
|
|
1059 |
// Load range labels for range list
|
|
1060 |
// ---------------------------------------------------------------------------
|
|
1061 |
//
|
|
1062 |
void CPeninputSplitQwertyWindow::ConstructRangeLabelListL( TInt /*aLangId*/ )
|
|
1063 |
{
|
|
1064 |
iRangeLabels.iLabelNativeChar.Zero();
|
|
1065 |
iRangeLabels.iLabelNativeNumber.Zero();
|
|
1066 |
iRangeLabels.iLabelLatinChar.Zero();
|
|
1067 |
iRangeLabels.iLabelLatinNumber.Zero();
|
|
1068 |
iRangeLabels.iLabelSymbol.Zero();
|
|
1069 |
iRangeLabels.iLabelAccent.Zero();
|
|
1070 |
|
|
1071 |
TInt resid = R_PENINPUT_LAYOUT_VKB_RANGES;
|
|
1072 |
|
|
1073 |
TResourceReader reader;
|
|
1074 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, resid );
|
|
1075 |
TPtrC ptr1 = reader.ReadTPtrC();
|
|
1076 |
TPtrC ptr2 = reader.ReadTPtrC();
|
|
1077 |
TPtrC ptr3 = reader.ReadTPtrC();
|
|
1078 |
TPtrC ptr4 = reader.ReadTPtrC();
|
|
1079 |
TPtrC ptr5 = reader.ReadTPtrC();
|
|
1080 |
TPtrC ptr6 = reader.ReadTPtrC();
|
|
1081 |
|
|
1082 |
iRangeLabels.iLabelNativeChar.Copy( ptr1 );
|
|
1083 |
iRangeLabels.iLabelNativeNumber.Copy( ptr2 );
|
|
1084 |
iRangeLabels.iLabelLatinChar.Copy( ptr3 );
|
|
1085 |
iRangeLabels.iLabelLatinNumber.Copy( ptr4 );
|
|
1086 |
iRangeLabels.iLabelSymbol.Copy( ptr5 );
|
|
1087 |
iRangeLabels.iLabelAccent.Copy( ptr6 );
|
|
1088 |
|
|
1089 |
CleanupStack::PopAndDestroy( 1 ); //reader
|
|
1090 |
}
|
|
1091 |
|
|
1092 |
// ---------------------------------------------------------------------------
|
|
1093 |
// Show or hide preview bubble
|
|
1094 |
// ---------------------------------------------------------------------------
|
|
1095 |
//
|
|
1096 |
void CPeninputSplitQwertyWindow::ShowBubble( TInt aShow )
|
|
1097 |
{
|
|
1098 |
iVkbCtrl->ShowBubble( aShow > 0 ? ETrue : EFalse );
|
|
1099 |
}
|
|
1100 |
|
|
1101 |
// ---------------------------------------------------------------------------
|
|
1102 |
// Update state of range button
|
|
1103 |
// ---------------------------------------------------------------------------
|
|
1104 |
//
|
|
1105 |
void CPeninputSplitQwertyWindow::UpdateRangeCtrlsL()
|
|
1106 |
{
|
|
1107 |
RArray<CFepLayoutChoiceList::SItem> items;
|
|
1108 |
PrepareRangeListItems( items );
|
|
1109 |
TInt count = items.Count();
|
|
1110 |
items.Close();
|
|
1111 |
|
|
1112 |
TInt languageId = IntContext( EPeninputDataTypeInputLanguage );
|
|
1113 |
TInt range = IntContext( EPeninputDataTypeCurrentRange );
|
|
1114 |
|
|
1115 |
TInt resId = -1;
|
|
1116 |
TInt aplhaRangeResId = -1;
|
|
1117 |
TInt numberRangeResId = -1;
|
|
1118 |
GetRangeIconResource( languageId, aplhaRangeResId, numberRangeResId );
|
|
1119 |
|
|
1120 |
if ( range == ERangeEnglish || range == ERangeNative )
|
|
1121 |
{
|
|
1122 |
resId = aplhaRangeResId;
|
|
1123 |
}
|
|
1124 |
else
|
|
1125 |
{
|
|
1126 |
resId = numberRangeResId;
|
|
1127 |
}
|
|
1128 |
|
|
1129 |
iRangeButton->SetResourceId( resId );
|
|
1130 |
iRangeButton->ConstructFromResourceL();
|
|
1131 |
iRangeButton->SetDimmed( count < 1 );
|
|
1132 |
}
|
|
1133 |
|
|
1134 |
// ---------------------------------------------------------------------------
|
|
1135 |
// Update layout position and size
|
|
1136 |
// ---------------------------------------------------------------------------
|
|
1137 |
//
|
|
1138 |
void CPeninputSplitQwertyWindow::UpdateLayoutPosAndSize()
|
|
1139 |
{
|
|
1140 |
if ( iLafMgr )
|
|
1141 |
{
|
|
1142 |
TRect rect = iLafMgr->ClientRect();
|
|
1143 |
TPoint pos = iLafMgr->EntirePaneRect().iTl;
|
|
1144 |
|
|
1145 |
UiLayout()->SetRect( rect );
|
|
1146 |
UiLayout()->LayoutOwner()->SetPosition( pos );
|
|
1147 |
}
|
|
1148 |
}
|
|
1149 |
|
|
1150 |
// ---------------------------------------------------------------------------
|
|
1151 |
// Set laf layout type
|
|
1152 |
// ---------------------------------------------------------------------------
|
|
1153 |
//
|
|
1154 |
void CPeninputSplitQwertyWindow::SetLafLayOut( TInt aRows, TInt aColumns )
|
|
1155 |
{
|
|
1156 |
iLafMgr->SetLayoutType(
|
|
1157 |
iLafMgr->LayoutTypeFromRowsColumns( aRows, aColumns )
|
|
1158 |
);
|
|
1159 |
}
|
|
1160 |
|
|
1161 |
// ---------------------------------------------------------------------------
|
|
1162 |
// Create custom control
|
|
1163 |
// ---------------------------------------------------------------------------
|
|
1164 |
//
|
|
1165 |
TBool CPeninputSplitQwertyWindow::CreateCustomControlL( TInt16 aControlId,
|
|
1166 |
TInt32 aImageId )
|
|
1167 |
{
|
|
1168 |
TBool create = ETrue;
|
|
1169 |
switch ( aControlId )
|
|
1170 |
{
|
|
1171 |
case EPeninupWindowCtrlIdArrowLeftBtn:
|
|
1172 |
{
|
|
1173 |
if ( iLayoutContext->LayoutType() != EPluginInputModeFSQ )
|
|
1174 |
{
|
|
1175 |
break;
|
|
1176 |
}
|
|
1177 |
|
|
1178 |
if ( !iArrowLeftButton )
|
|
1179 |
{
|
|
1180 |
iArrowLeftButton = CAknFepCtrlRepeatButton::NewL(
|
|
1181 |
UiLayout(),
|
|
1182 |
aControlId,
|
|
1183 |
EPeninputLayoutEventLeftArrow,
|
|
1184 |
EKeyLeftArrow,
|
|
1185 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
1186 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
1187 |
KAknsIIDQsnFrFunctionButtonInactive );
|
|
1188 |
|
|
1189 |
AddControlL( iArrowLeftButton );
|
|
1190 |
iArrowLeftButton->AddEventObserver( UiLayout() );
|
|
1191 |
iArrowLeftButton->SetResourceId( aImageId );
|
|
1192 |
}
|
|
1193 |
|
|
1194 |
iArrowLeftButton->ConstructFromResourceL();
|
|
1195 |
}
|
|
1196 |
break;
|
|
1197 |
case EPeninupWindowCtrlIdArrowRightBtn:
|
|
1198 |
{
|
|
1199 |
if ( iLayoutContext->LayoutType() != EPluginInputModeFSQ )
|
|
1200 |
{
|
|
1201 |
break;
|
|
1202 |
}
|
|
1203 |
|
|
1204 |
if ( !iArrowRightButton )
|
|
1205 |
{
|
|
1206 |
iArrowRightButton = CAknFepCtrlRepeatButton::NewL(
|
|
1207 |
UiLayout(),
|
|
1208 |
aControlId,
|
|
1209 |
EPeninputLayoutEventRightArrow,
|
|
1210 |
EKeyRightArrow,
|
|
1211 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
1212 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
1213 |
KAknsIIDQsnFrFunctionButtonInactive );
|
|
1214 |
|
|
1215 |
AddControlL( iArrowRightButton );
|
|
1216 |
iArrowRightButton->AddEventObserver( UiLayout() );
|
|
1217 |
iArrowRightButton->SetResourceId( aImageId );
|
|
1218 |
}
|
|
1219 |
iArrowRightButton->ConstructFromResourceL();
|
|
1220 |
}
|
|
1221 |
break;
|
|
1222 |
default:
|
|
1223 |
{
|
|
1224 |
create = EFalse;
|
|
1225 |
}
|
|
1226 |
}
|
|
1227 |
return create;
|
|
1228 |
}
|
|
1229 |
|
|
1230 |
// ---------------------------------------------------------------------------
|
|
1231 |
// Add custom control to this group
|
|
1232 |
// ---------------------------------------------------------------------------
|
|
1233 |
//
|
|
1234 |
void CPeninputSplitQwertyWindow::AddCustomControlGroupL( CFepUiBaseCtrl* aCtrl )
|
|
1235 |
{
|
|
1236 |
AddControlL( aCtrl );
|
|
1237 |
}
|
|
1238 |
|
|
1239 |
// ---------------------------------------------------------------------------
|
|
1240 |
// Set layout size
|
|
1241 |
// ---------------------------------------------------------------------------
|
|
1242 |
//
|
|
1243 |
void CPeninputSplitQwertyWindow::SetVkbLayoutSize()
|
|
1244 |
{
|
|
1245 |
TRect outrect,innerrect;
|
|
1246 |
iLafMgr->GetPreviewWndRect( outrect, innerrect );
|
|
1247 |
|
|
1248 |
iVkbCtrl->SetTextFormat( iLafMgr->PreviewWndText() ); //Read laf
|
|
1249 |
|
|
1250 |
TSize bubbleSize( outrect.Width(), outrect.Height() );
|
|
1251 |
iVkbCtrl->SetBubbleSize( bubbleSize ); // Read laf
|
|
1252 |
|
|
1253 |
iVkbCtrl->SetFrameDiff( innerrect.iTl.iX - outrect.iTl.iX,
|
|
1254 |
innerrect.iTl.iY - outrect.iTl.iY,
|
|
1255 |
outrect.iBr.iX - innerrect.iBr.iX,
|
|
1256 |
outrect.iBr.iY - innerrect.iBr.iY );
|
|
1257 |
|
|
1258 |
TInt vkbLayoutid = IntContext( EPeninputDataTypeVkbLayout );
|
|
1259 |
CPeninputVkbLayoutInfo* vkbLayout = ConfigInfo()->FindVkbLayoutInfo(
|
|
1260 |
vkbLayoutid );
|
|
1261 |
|
|
1262 |
// Calculate current vkblayout according current layout
|
|
1263 |
if ( vkbLayout )
|
|
1264 |
{
|
|
1265 |
const TInt columns = vkbLayout->Columns();
|
|
1266 |
const TInt rows = vkbLayout->Rows();
|
|
1267 |
TRect keyRect;
|
|
1268 |
TRect charRect;
|
|
1269 |
|
|
1270 |
//iLafMgr->SetLayoutType(iLafMgr->LayoutTypeFromRowsColumns(rows,columns));
|
|
1271 |
|
|
1272 |
for ( TInt exter = 0; exter < rows; exter++ )
|
|
1273 |
{
|
|
1274 |
for ( TInt inter = 0; inter < columns; inter++ )
|
|
1275 |
{
|
|
1276 |
iLafMgr->GetKeyRect( inter, exter, keyRect, charRect );
|
|
1277 |
vkbLayout->SetKeyInfo( exter, inter, keyRect, charRect,
|
|
1278 |
iLafMgr->KeyTextFont() );
|
|
1279 |
}
|
|
1280 |
}
|
|
1281 |
|
|
1282 |
if ( iVkbCtrl->IsIrregularKeyBoard() )
|
|
1283 |
{
|
|
1284 |
CFbsBitmap* bitmap = iVkbCtrl->IrregularKeyBitmap( EKeyLeftDown,
|
|
1285 |
EKeyStateNormal );
|
|
1286 |
|
|
1287 |
TSize curSize = vkbLayout->KeyInfoList()[0]->Key()->Rect().Size();
|
|
1288 |
TSize size = bitmap->SizeInPixels();
|
|
1289 |
if ( curSize != size )
|
|
1290 |
{
|
|
1291 |
for ( TInt i = 0; i <= EKeyRightUp; i++ )
|
|
1292 |
{
|
|
1293 |
for ( TInt j = 0; j <= EKeyStateDimmedMask; j++ )
|
|
1294 |
{
|
|
1295 |
bitmap = iVkbCtrl->IrregularKeyBitmap(
|
|
1296 |
(TVirtualKeyIrregularKeyType)i,
|
|
1297 |
(TVirtualKeyIrregularKeyState)j );
|
|
1298 |
|
|
1299 |
AknIconUtils::SetSize( bitmap, curSize,
|
|
1300 |
EAspectRatioNotPreserved );
|
|
1301 |
|
|
1302 |
}
|
|
1303 |
}
|
|
1304 |
}
|
|
1305 |
}
|
|
1306 |
else
|
|
1307 |
{
|
|
1308 |
CFbsBitmap* bitmap = iVkbCtrl->NonIrregularKeyBitmap( EKeyBmpNormal );
|
|
1309 |
TSize curSize = vkbLayout->KeyInfoList()[0]->Key()->Rect().Size();
|
|
1310 |
TSize size = bitmap->SizeInPixels();
|
|
1311 |
if( curSize != size )
|
|
1312 |
{
|
|
1313 |
for ( TInt i = 0; i <= EKeyBmpLastType; i++ )
|
|
1314 |
{
|
|
1315 |
bitmap = iVkbCtrl->NonIrregularKeyBitmap( (TVirtualKeyBmpType)i );
|
|
1316 |
if( bitmap )
|
|
1317 |
{
|
|
1318 |
AknIconUtils::SetSize( bitmap, curSize,
|
|
1319 |
EAspectRatioNotPreserved );
|
|
1320 |
}
|
|
1321 |
}
|
|
1322 |
}
|
|
1323 |
}
|
|
1324 |
}
|
|
1325 |
}
|
|
1326 |
|
|
1327 |
// ---------------------------------------------------------------------------
|
|
1328 |
// C++ constructor
|
|
1329 |
// ---------------------------------------------------------------------------
|
|
1330 |
//
|
|
1331 |
CPeninputSplitQwertyWindow::CPeninputSplitQwertyWindow(
|
|
1332 |
CFepUiLayout* aUiLayout,
|
|
1333 |
MPeninputLayoutContext* aLayoutContext,
|
|
1334 |
MPeninputUiStateMgr* aUiStateMgr )
|
|
1335 |
: CPeninputLayoutWindowExt( aUiLayout, aLayoutContext )
|
|
1336 |
, iUiStateMgr( aUiStateMgr )
|
|
1337 |
, iPopupInited( EFalse )
|
|
1338 |
, iPopupSet( EFalse )
|
|
1339 |
, iFirstConstruct( ETrue )
|
|
1340 |
{
|
|
1341 |
}
|
|
1342 |
|
|
1343 |
// ---------------------------------------------------------------------------
|
|
1344 |
// Symbian constructor
|
|
1345 |
// ---------------------------------------------------------------------------
|
|
1346 |
//
|
|
1347 |
void CPeninputSplitQwertyWindow::ConstructL()
|
|
1348 |
{
|
|
1349 |
iBmpRotator = CPeninputSyncBitmapRotator::NewL();
|
|
1350 |
iLafMgr = CPeninputSplitQwertyLafMgr::NewL();
|
|
1351 |
iLafMgr->SetInputModeL( TPluginInputMode( iLayoutContext->LayoutType() ) );
|
|
1352 |
CPeninputLayoutWindowExt::ConstructL();
|
|
1353 |
}
|
|
1354 |
|
|
1355 |
// ---------------------------------------------------------------------------
|
|
1356 |
// Add range bar into client area
|
|
1357 |
// ---------------------------------------------------------------------------
|
|
1358 |
//
|
|
1359 |
void CPeninputSplitQwertyWindow::AddRangeBarL()
|
|
1360 |
{
|
|
1361 |
CAknFepCtrlLongPressButton* button = CAknFepCtrlLongPressButton::NewL(
|
|
1362 |
UiLayout(),
|
|
1363 |
EPeninutWindowCtrlIdRangeBtn,
|
|
1364 |
0xffff, 0,
|
|
1365 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
1366 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
1367 |
KAknsIIDQsnFrFunctionButtonInactive );
|
|
1368 |
|
|
1369 |
CleanupStack::PushL( button );
|
|
1370 |
button->SetResourceId( R_PENINPUT_LAYOUT_VKB_RANGE_DEFAULT );
|
|
1371 |
button->ConstructFromResourceL();
|
|
1372 |
AddControlL( button );
|
|
1373 |
CleanupStack::Pop( button );
|
|
1374 |
|
|
1375 |
button->AddEventObserver( UiLayout() );
|
|
1376 |
iRangeButton = button;
|
|
1377 |
}
|
|
1378 |
|
|
1379 |
// ---------------------------------------------------------------------------
|
|
1380 |
// Add button to client area
|
|
1381 |
// ---------------------------------------------------------------------------
|
|
1382 |
//
|
|
1383 |
CAknFepCtrlEventButton* CPeninputSplitQwertyWindow::AddButtonL(
|
|
1384 |
const TInt aControlId,
|
|
1385 |
const TInt aEventId,
|
|
1386 |
const TInt aResId,
|
|
1387 |
const TInt aUnicode,
|
|
1388 |
const TBool aIsRepeat )
|
|
1389 |
{
|
|
1390 |
CAknFepCtrlEventButton* button = NULL;
|
|
1391 |
|
|
1392 |
if ( aIsRepeat )
|
|
1393 |
{
|
|
1394 |
button = CAknFepCtrlRepeatButton::NewL( UiLayout(),
|
|
1395 |
aControlId,
|
|
1396 |
aEventId,
|
|
1397 |
aUnicode );
|
|
1398 |
}
|
|
1399 |
else
|
|
1400 |
{
|
|
1401 |
button = CAknFepCtrlEventButton::NewL( UiLayout(),
|
|
1402 |
aControlId,
|
|
1403 |
aEventId,
|
|
1404 |
aUnicode );
|
|
1405 |
}
|
|
1406 |
|
|
1407 |
CleanupStack::PushL( button );
|
|
1408 |
if ( button )
|
|
1409 |
{
|
|
1410 |
// Read resource
|
|
1411 |
TResourceReader reader;
|
|
1412 |
|
|
1413 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId );
|
|
1414 |
button->SetResourceId( aResId );
|
|
1415 |
button->ConstructFromResourceL();
|
|
1416 |
// Pop and destroy reader
|
|
1417 |
CleanupStack::PopAndDestroy( 1 );
|
|
1418 |
|
|
1419 |
// Add into the control pool
|
|
1420 |
AddControlL( button );
|
|
1421 |
button->AddEventObserver(UiLayout());
|
|
1422 |
|
|
1423 |
}
|
|
1424 |
CleanupStack::Pop( button );
|
|
1425 |
|
|
1426 |
return button;
|
|
1427 |
}
|
|
1428 |
|
|
1429 |
// ---------------------------------------------------------------------------
|
|
1430 |
// Add popup window to display accented char list
|
|
1431 |
// ---------------------------------------------------------------------------
|
|
1432 |
//
|
|
1433 |
void CPeninputSplitQwertyWindow::AddPopupWindowL()
|
|
1434 |
{
|
|
1435 |
iPopupWnd = CPeninputCommonChoiceList::NewL(
|
|
1436 |
UiLayout(),
|
|
1437 |
EPeninutWindowCtrlIdAccentPopupWindow,
|
|
1438 |
KAknsIIDQsnFrList,
|
|
1439 |
KAknsIIDQsnFrPopupSub );
|
|
1440 |
|
|
1441 |
iPopupWnd->AddEventObserver( UiLayout() );
|
|
1442 |
|
|
1443 |
AddControlL( iPopupWnd );
|
|
1444 |
iIdle = CIdle::NewL( CActive::EPriorityIdle );
|
|
1445 |
iIdle ->Start( TCallBack( BackgroundTaskL, this ) );
|
|
1446 |
}
|
|
1447 |
|
|
1448 |
// ---------------------------------------------------------------------------
|
|
1449 |
// Reorgnize position and size of function buttons
|
|
1450 |
// ---------------------------------------------------------------------------
|
|
1451 |
//
|
|
1452 |
void CPeninputSplitQwertyWindow::ReorgnizeTitleBar()
|
|
1453 |
{
|
|
1454 |
TRect inner, bound;
|
|
1455 |
|
|
1456 |
CAknFepCtrlEventButton* evtButton = NULL;
|
|
1457 |
CAknFepCtrlCommonButton* cmmButton = NULL;
|
|
1458 |
TBool bBKSizeChanged = EFalse;
|
|
1459 |
|
|
1460 |
evtButton = EventButtonCtrl( EPeninutWindowCtrlIdOptionBtn );
|
|
1461 |
if ( evtButton )
|
|
1462 |
{
|
|
1463 |
iLafMgr->GetButtonRect(EPeninutWindowCtrlIdOptionBtn, bound, inner );
|
|
1464 |
evtButton->SizeChanged( bound, inner, ETrue );
|
|
1465 |
}
|
|
1466 |
|
|
1467 |
cmmButton = CommonButtonCtrl( EPeninutWindowCtrlIdCloseBtn );
|
|
1468 |
if ( cmmButton )
|
|
1469 |
{
|
|
1470 |
iLafMgr->GetButtonRect(EPeninutWindowCtrlIdCloseBtn, bound ,inner );
|
|
1471 |
cmmButton->SizeChanged( bound, inner, ETrue );
|
|
1472 |
}
|
|
1473 |
|
|
1474 |
cmmButton = CommonButtonCtrl( EPeninutWindowCtrlIdBackspaceBtn );
|
|
1475 |
if ( cmmButton )
|
|
1476 |
{
|
|
1477 |
iLafMgr->GetButtonRect( EPeninutWindowCtrlIdBackspaceBtn, bound, inner );
|
|
1478 |
|
|
1479 |
if( bound.Size() != cmmButton->Rect().Size() &&
|
|
1480 |
inner.Size() != cmmButton->ForgroundBmpRect().Size() )
|
|
1481 |
{
|
|
1482 |
bBKSizeChanged = ETrue;
|
|
1483 |
}
|
|
1484 |
cmmButton->SizeChanged( bound, inner, ETrue );
|
|
1485 |
}
|
|
1486 |
|
|
1487 |
cmmButton = CommonButtonCtrl( EPeninutWindowCtrlIdSpaceBtn );
|
|
1488 |
if ( cmmButton )
|
|
1489 |
{
|
|
1490 |
iLafMgr->GetButtonRect(EPeninutWindowCtrlIdSpaceBtn, bound, inner );
|
|
1491 |
inner = bound;
|
|
1492 |
inner.Shrink( 10, 0 );
|
|
1493 |
|
|
1494 |
cmmButton->SizeChanged( bound, inner, ETrue );
|
|
1495 |
|
|
1496 |
TRect spaceIconRect = inner;
|
|
1497 |
spaceIconRect.Shrink( 10, 0 );
|
|
1498 |
TDraw3PiecesFrame draw3pic( KAknsIIDQgnIndiInputSpaceL,
|
|
1499 |
KAknsIIDQgnIndiInputSpaceMiddle,
|
|
1500 |
KAknsIIDQgnIndiInputSpaceR,
|
|
1501 |
spaceIconRect);
|
|
1502 |
cmmButton->SetDraw3PieceFrameInfo( draw3pic );
|
|
1503 |
}
|
|
1504 |
|
|
1505 |
if ( iRangeButton )
|
|
1506 |
{
|
|
1507 |
iLafMgr->GetButtonRect( EPeninutWindowCtrlIdRangeBtn, bound, inner );
|
|
1508 |
iRangeButton->SetRect( bound );
|
|
1509 |
iRangeButton->SizeChanged( bound, inner, ETrue );
|
|
1510 |
}
|
|
1511 |
|
|
1512 |
if ( iArrowLeftButton )
|
|
1513 |
{
|
|
1514 |
iLafMgr->GetButtonRect( EPeninupWindowCtrlIdArrowLeftBtn, bound, inner );
|
|
1515 |
iArrowLeftButton->SizeChanged( bound, inner, ETrue );
|
|
1516 |
}
|
|
1517 |
if ( iArrowRightButton )
|
|
1518 |
{
|
|
1519 |
iLafMgr->GetButtonRect( EPeninupWindowCtrlIdArrowRightBtn, bound, inner );
|
|
1520 |
iArrowRightButton->SizeChanged( bound, inner, ETrue );
|
|
1521 |
}
|
|
1522 |
|
|
1523 |
//If backspace size changed when language is RtoL mirror should be used
|
|
1524 |
if ( bBKSizeChanged && IsRtoLLanguage( iLanguage ) )
|
|
1525 |
{
|
|
1526 |
//Mirror backspace graphic
|
|
1527 |
HandleButtonResOnLangDirChange( EPeninutWindowCtrlIdBackspaceBtn );
|
|
1528 |
}
|
|
1529 |
}
|
|
1530 |
|
|
1531 |
|
|
1532 |
// ---------------------------------------------------------------------------
|
|
1533 |
// Show range list
|
|
1534 |
// ---------------------------------------------------------------------------
|
|
1535 |
//
|
|
1536 |
void CPeninputSplitQwertyWindow::PopupRangeListL()
|
|
1537 |
{
|
|
1538 |
if ( !iPopupInited )
|
|
1539 |
{
|
|
1540 |
TRAP_IGNORE( DoIdleConstructL() );
|
|
1541 |
}
|
|
1542 |
|
|
1543 |
|
|
1544 |
iPopupWnd->ClearItemsL();
|
|
1545 |
RArray<CFepLayoutChoiceList::SItem> items;
|
|
1546 |
PrepareRangeListItems( items );
|
|
1547 |
TInt count = items.Count();
|
|
1548 |
for ( TInt i = 0; i < count; i++ )
|
|
1549 |
{
|
|
1550 |
iPopupWnd->AddItemL( items[i] );
|
|
1551 |
}
|
|
1552 |
items.Close();
|
|
1553 |
|
|
1554 |
if ( iPopupWnd->ItemsCount() < 1 )
|
|
1555 |
{
|
|
1556 |
return;
|
|
1557 |
}
|
|
1558 |
|
|
1559 |
if ( iPopupWnd->ItemsCount() < 2 )
|
|
1560 |
{
|
|
1561 |
const CFepLayoutChoiceList::SItem* item = iPopupWnd->ItemByIndex( 0 );
|
|
1562 |
CFepLayoutChoiceList::SEvent event;
|
|
1563 |
event.iIndex = 0;
|
|
1564 |
event.iCommand = item->iCommand;
|
|
1565 |
TPtrC ptr;
|
|
1566 |
ptr.Set(reinterpret_cast<TText*>(&event), sizeof(event));
|
|
1567 |
HandleRangeListSelectedL( iPopupWnd, ptr );
|
|
1568 |
return;
|
|
1569 |
}
|
|
1570 |
|
|
1571 |
CFepUiBaseCtrl* btn = Control( EPeninutWindowCtrlIdRangeBtn );
|
|
1572 |
iPopupWnd->SetListColumnNumWithLafL( iPopupWnd->ItemsCount() );
|
|
1573 |
iPopupWnd->SetCurrentFocusedIndex( - 1 ); //no active item
|
|
1574 |
iPopupWnd->Display( btn->Rect() );
|
|
1575 |
iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStatePopup );
|
|
1576 |
}
|
|
1577 |
|
|
1578 |
// ---------------------------------------------------------------------------
|
|
1579 |
// get resource info of accented chars popup window
|
|
1580 |
// ---------------------------------------------------------------------------
|
|
1581 |
//
|
|
1582 |
void CPeninputSplitQwertyWindow::GetPopupWndInfoFromResL( TResourceReader aRes,
|
|
1583 |
const TRect& aRect )
|
|
1584 |
{
|
|
1585 |
TPtrC bmpFileName = aRes.ReadTPtrC();
|
|
1586 |
TInt32 imgMajorSkinId = aRes.ReadInt32();
|
|
1587 |
|
|
1588 |
TAknsItemID id;
|
|
1589 |
|
|
1590 |
MAknsSkinInstance* skininstance = UiLayout()->SkinInstance();
|
|
1591 |
|
|
1592 |
TInt popWinBmpId = aRes.ReadInt16();
|
|
1593 |
TInt popWinBmpMaskId = aRes.ReadInt16();
|
|
1594 |
TInt popWinBmpSkinId = aRes.ReadInt16();
|
|
1595 |
|
|
1596 |
id.Set( TInt( imgMajorSkinId ), popWinBmpSkinId );
|
|
1597 |
|
|
1598 |
if ( popWinBmpId != KInvalidImg )
|
|
1599 |
{
|
|
1600 |
AknsUtils::CreateIconL( skininstance,
|
|
1601 |
id,
|
|
1602 |
iPopupWndBgImg,
|
|
1603 |
bmpFileName,
|
|
1604 |
popWinBmpId );
|
|
1605 |
|
|
1606 |
AknIconUtils::SetSize( iPopupWndBgImg, TSize( aRect.Width(),
|
|
1607 |
aRect.Height() * 3 ), EAspectRatioNotPreserved );
|
|
1608 |
iPopupWnd->SetBackgroundBitmapL( iPopupWndBgImg );
|
|
1609 |
}
|
|
1610 |
|
|
1611 |
TInt focusBmpId = aRes.ReadInt16();
|
|
1612 |
TInt focusBmpMaskId = aRes.ReadInt16();
|
|
1613 |
TInt focusBmpSkinId = aRes.ReadInt16();
|
|
1614 |
|
|
1615 |
id.Set( TInt( imgMajorSkinId ), focusBmpSkinId );
|
|
1616 |
|
|
1617 |
if ( focusBmpId != KInvalidImg )
|
|
1618 |
{
|
|
1619 |
AknsUtils::CreateIconL( skininstance,
|
|
1620 |
id,
|
|
1621 |
iPopupWndFocusImg,
|
|
1622 |
bmpFileName,
|
|
1623 |
focusBmpId );
|
|
1624 |
|
|
1625 |
AknIconUtils::SetSize( iPopupWndFocusImg,
|
|
1626 |
TSize( aRect.Width(),aRect.Height() * 3 ),
|
|
1627 |
EAspectRatioNotPreserved );
|
|
1628 |
|
|
1629 |
iPopupWnd->SetFocusBmp( iPopupWndFocusImg );
|
|
1630 |
}
|
|
1631 |
}
|
|
1632 |
|
|
1633 |
// ---------------------------------------------------------------------------
|
|
1634 |
// Background constructor
|
|
1635 |
// ---------------------------------------------------------------------------
|
|
1636 |
//
|
|
1637 |
void CPeninputSplitQwertyWindow::DoIdleConstructL()
|
|
1638 |
{
|
|
1639 |
if( iPopupInited )
|
|
1640 |
{
|
|
1641 |
return;
|
|
1642 |
}
|
|
1643 |
|
|
1644 |
// Read resource
|
|
1645 |
TResourceReader reader;
|
|
1646 |
CCoeEnv::Static()->CreateResourceReaderLC( reader,
|
|
1647 |
R_PENINPUT_LAYOUT_VKB_POPUP_WINDOW );
|
|
1648 |
|
|
1649 |
GetPopupWndInfoFromResL( reader, iPopupItemRect );
|
|
1650 |
|
|
1651 |
// Pop and destroy reader
|
|
1652 |
CleanupStack::PopAndDestroy( 1 );
|
|
1653 |
|
|
1654 |
}
|
|
1655 |
|
|
1656 |
// ---------------------------------------------------------------------------
|
|
1657 |
// Simulate raw event
|
|
1658 |
// ---------------------------------------------------------------------------
|
|
1659 |
//
|
|
1660 |
void CPeninputSplitQwertyWindow::SimulateRawEvent( TInt aScanCode,
|
|
1661 |
TRawEvent::TType aType )
|
|
1662 |
{
|
|
1663 |
TRawEvent event;
|
|
1664 |
event.Set( aType, aScanCode );
|
|
1665 |
|
|
1666 |
TPtrC eventPtr( reinterpret_cast<const TUint16*>(&event),
|
|
1667 |
sizeof(event)/sizeof(TUint16) );
|
|
1668 |
|
|
1669 |
UiLayout()->SignalOwner(ESignalSimulateEvent,eventPtr);
|
|
1670 |
}
|
|
1671 |
|
|
1672 |
|
|
1673 |
// ---------------------------------------------------------------------------
|
|
1674 |
// Handle size changed for range list
|
|
1675 |
// ---------------------------------------------------------------------------
|
|
1676 |
//
|
|
1677 |
void CPeninputSplitQwertyWindow::HandlePopupSizeChange()
|
|
1678 |
{
|
|
1679 |
if ( IntContext( EAkninputDataTypeSizeChanging ) || (!iPopupSet) )
|
|
1680 |
{
|
|
1681 |
// if size changing, or popup window's property has not been set yet
|
|
1682 |
TAknWindowLineLayout appWnd = AknLayoutScalable_Avkon::application_window(0).LayoutLine();
|
|
1683 |
iAppWndRect = appWnd.Rect();
|
|
1684 |
|
|
1685 |
TAknWindowLineLayout mainPane = AknLayoutScalable_Avkon::main_pane(4).LayoutLine();
|
|
1686 |
TAknLayoutRect mainPaneRect;
|
|
1687 |
mainPaneRect.LayoutRect( iAppWndRect, mainPane );
|
|
1688 |
|
|
1689 |
TAknWindowLineLayout choiceWnd = AknLayoutScalable_Avkon::popup_choice_list_window(1).LayoutLine();
|
|
1690 |
TAknLayoutRect choiceRect;
|
|
1691 |
choiceRect.LayoutRect( mainPaneRect.Rect(), choiceWnd );
|
|
1692 |
|
|
1693 |
iPopupItemRect = TRect( 0, 0, choiceRect.Rect().Width(),
|
|
1694 |
AknLayoutScalable_Avkon::list_single_choice_list_pane(0).LayoutLine().iH );
|
|
1695 |
|
|
1696 |
iChoiceTextLayout =
|
|
1697 |
AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1).LayoutLine();
|
|
1698 |
}
|
|
1699 |
|
|
1700 |
const CFont* font = AknLayoutUtils::FontFromId( iChoiceTextLayout.iFont, NULL );
|
|
1701 |
iPopupWnd->SetFont( font );
|
|
1702 |
iPopupWnd->SetItemRect( iPopupItemRect, iPopupItemRect );
|
|
1703 |
|
|
1704 |
TInt leftMargin = iChoiceTextLayout.il;
|
|
1705 |
|
|
1706 |
iPopupWnd->SetMarginAndBaseline( leftMargin, font->HeightInPixels() );
|
|
1707 |
|
|
1708 |
iPopupWnd->SetFontColor( AKN_LAF_COLOR_STATIC( iChoiceTextLayout.iC ) );
|
|
1709 |
|
|
1710 |
TSize imgSize ( iPopupItemRect.Width(), iPopupItemRect.Height() * 3 );
|
|
1711 |
AknIconUtils::SetSize( iPopupWndBgImg, imgSize, EAspectRatioNotPreserved );
|
|
1712 |
AknIconUtils::SetSize(iPopupWndFocusImg, imgSize, EAspectRatioNotPreserved );
|
|
1713 |
|
|
1714 |
iPopupSet = ETrue;
|
|
1715 |
}
|
|
1716 |
|
|
1717 |
|
|
1718 |
// ---------------------------------------------------------------------------
|
|
1719 |
// Handle dead key event
|
|
1720 |
// ---------------------------------------------------------------------------
|
|
1721 |
//
|
|
1722 |
TBool CPeninputSplitQwertyWindow::HandleDeadKeyL( TInt aEventType,
|
|
1723 |
const TDesC& aEventData )
|
|
1724 |
{
|
|
1725 |
// Set DeadKey to unlatched state
|
|
1726 |
TBool deadKeyChange = EFalse;
|
|
1727 |
iLayoutContext->SetData( EAkninputDataTypeLatchedSet, &deadKeyChange );
|
|
1728 |
UnLatchDeadKey( iNewDeadKeyBuf );
|
|
1729 |
|
|
1730 |
// Handle dead key when ITI is enable
|
|
1731 |
CPeninputSplitQwertyLayout* layout
|
|
1732 |
= static_cast<CPeninputSplitQwertyLayout*>( UiLayout() );
|
|
1733 |
if ( layout->IsEnableITI() )
|
|
1734 |
{
|
|
1735 |
TBuf<KKeyCodeSize> buf;
|
|
1736 |
TKeyEvent* event = (TKeyEvent*) aEventData.Ptr();
|
|
1737 |
buf.Append( event->iCode );
|
|
1738 |
|
|
1739 |
HBufC* newCharBuf = HBufC::NewL( iNewDeadKeyBuf.Length() + buf.Length() );
|
|
1740 |
if( newCharBuf )
|
|
1741 |
{
|
|
1742 |
newCharBuf->Des().Append( iNewDeadKeyBuf );
|
|
1743 |
newCharBuf->Des().Append( buf );
|
|
1744 |
|
|
1745 |
// Submit DeadKey + Key at the same time
|
|
1746 |
UiLayout()->SignalOwner(ESignalKeyEvent,*newCharBuf);
|
|
1747 |
|
|
1748 |
delete newCharBuf;
|
|
1749 |
newCharBuf = NULL;
|
|
1750 |
}
|
|
1751 |
|
|
1752 |
return ETrue;
|
|
1753 |
}
|
|
1754 |
|
|
1755 |
// Get the accent char
|
|
1756 |
HBufC* newCharBuf = HBufC::NewL( KKeyCodeSize );
|
|
1757 |
|
|
1758 |
TBool handled = HandleAccentCharEvent( aEventType,
|
|
1759 |
aEventData,
|
|
1760 |
iNewDeadKeyBuf,
|
|
1761 |
newCharBuf );
|
|
1762 |
|
|
1763 |
if( handled )
|
|
1764 |
{
|
|
1765 |
// Send ths accent key to FEP
|
|
1766 |
UiLayout()->SignalOwner( ESignalKeyEvent, *newCharBuf );
|
|
1767 |
iNewDeadKeyBuf = KNullDesC;
|
|
1768 |
delete newCharBuf;
|
|
1769 |
newCharBuf = NULL;
|
|
1770 |
return ETrue;
|
|
1771 |
}
|
|
1772 |
|
|
1773 |
delete newCharBuf;
|
|
1774 |
newCharBuf = NULL;
|
|
1775 |
|
|
1776 |
return EFalse;
|
|
1777 |
}
|
|
1778 |
|
|
1779 |
// --------------------------------------------------------------------------
|
|
1780 |
// Handle resource of button(base on language direction)
|
|
1781 |
// --------------------------------------------------------------------------
|
|
1782 |
//
|
|
1783 |
void CPeninputSplitQwertyWindow::HandleButtonResOnLangDirChange( TInt aControlId )
|
|
1784 |
{
|
|
1785 |
TRAP_IGNORE( HandleButtonResOnLangDirChangeL( aControlId ) );
|
|
1786 |
}
|
|
1787 |
|
|
1788 |
// ---------------------------------------------------------------------------
|
|
1789 |
// Handle resource of button(base on language direction)
|
|
1790 |
// ---------------------------------------------------------------------------
|
|
1791 |
//
|
|
1792 |
void CPeninputSplitQwertyWindow::HandleButtonResOnLangDirChangeL( TInt aControlId )
|
|
1793 |
{
|
|
1794 |
CAknFepCtrlCommonButton* ctrl = CommonButtonCtrl( aControlId );
|
|
1795 |
if ( ctrl && iBmpRotator )
|
|
1796 |
{
|
|
1797 |
TSyncRotationAngle rotChoice = CBitmapRotator::EMirrorVerticalAxis;
|
|
1798 |
|
|
1799 |
User::LeaveIfError(
|
|
1800 |
iBmpRotator->Rotate( *ctrl->ForgroundBmp() ,rotChoice )
|
|
1801 |
);
|
|
1802 |
|
|
1803 |
User::LeaveIfError(
|
|
1804 |
iBmpRotator->Rotate( *ctrl->ForgroundBmpMask(), rotChoice )
|
|
1805 |
);
|
|
1806 |
}
|
|
1807 |
}
|
|
1808 |
|
|
1809 |
// ---------------------------------------------------------------------------
|
|
1810 |
// Utils to get context value
|
|
1811 |
// ---------------------------------------------------------------------------
|
|
1812 |
//
|
|
1813 |
TInt CPeninputSplitQwertyWindow::IntContext( TPeninputDataType aDataIndex )
|
|
1814 |
{
|
|
1815 |
return CPeninputDataConverter::AnyToInt(
|
|
1816 |
iLayoutContext->RequestData( aDataIndex )
|
|
1817 |
);
|
|
1818 |
}
|
|
1819 |
|
|
1820 |
// ---------------------------------------------------------------------------
|
|
1821 |
// Handle range list event
|
|
1822 |
// ---------------------------------------------------------------------------
|
|
1823 |
//
|
|
1824 |
void CPeninputSplitQwertyWindow::HandleRangeListSelectedL( CFepUiBaseCtrl* /*aCtrl*/,
|
|
1825 |
const TDesC& aData )
|
|
1826 |
{
|
|
1827 |
CFepLayoutChoiceList::SEvent* event = (CFepLayoutChoiceList::SEvent*)aData.Ptr();
|
|
1828 |
|
|
1829 |
TInt index = -1;
|
|
1830 |
TInt range = ERangeInvalid;
|
|
1831 |
|
|
1832 |
if ( event->iCommand == EPeninputVkbLayoutNativeChar )
|
|
1833 |
{
|
|
1834 |
range = ERangeNative;
|
|
1835 |
}
|
|
1836 |
|
|
1837 |
else if ( event->iCommand == EPeninputVkbLayoutNativeNumber )
|
|
1838 |
{
|
|
1839 |
range = ERangeNativeNumber;
|
|
1840 |
}
|
|
1841 |
|
|
1842 |
else if ( event->iCommand == EPeninputVkbLayoutLatinChar )
|
|
1843 |
{
|
|
1844 |
range = ERangeEnglish;
|
|
1845 |
}
|
|
1846 |
|
|
1847 |
else if ( event->iCommand == EPeninputVkbLayoutLatinNumber )
|
|
1848 |
{
|
|
1849 |
range = ERangeNumber;
|
|
1850 |
}
|
|
1851 |
|
|
1852 |
else if ( event->iCommand == EPeninputVkbLayoutSymbol )
|
|
1853 |
{
|
|
1854 |
range = ERangeSymbol;
|
|
1855 |
}
|
|
1856 |
|
|
1857 |
else if ( event->iCommand == EPeninputVkbLayoutAccented1 )
|
|
1858 |
{
|
|
1859 |
index = 0;
|
|
1860 |
range = ERangeAccent;
|
|
1861 |
}
|
|
1862 |
|
|
1863 |
else if ( event->iCommand == EPeninputVkbLayoutAccented2 )
|
|
1864 |
{
|
|
1865 |
index = 1;
|
|
1866 |
range = ERangeAccent;
|
|
1867 |
}
|
|
1868 |
|
|
1869 |
else if ( event->iCommand == EPeninputVkbLayoutAccented3 )
|
|
1870 |
{
|
|
1871 |
index = 2;
|
|
1872 |
range = ERangeAccent;
|
|
1873 |
}
|
|
1874 |
|
|
1875 |
TInt currentRange = IntContext( EPeninputDataTypeCurrentRange );
|
|
1876 |
TInt currentAccent = IntContext( EPeninputDataTypeCurrentAccent );
|
|
1877 |
|
|
1878 |
if ( currentRange == range )
|
|
1879 |
{
|
|
1880 |
if ( range != ERangeAccent || currentAccent == index )
|
|
1881 |
{
|
|
1882 |
iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby );
|
|
1883 |
return;
|
|
1884 |
}
|
|
1885 |
}
|
|
1886 |
|
|
1887 |
iLayoutContext->SetData( EPeninputDataTypeCurrentAccent, &index );
|
|
1888 |
|
|
1889 |
if ( range != ERangeAccent )
|
|
1890 |
{
|
|
1891 |
ChangeRange( range );
|
|
1892 |
}
|
|
1893 |
else
|
|
1894 |
{
|
|
1895 |
ChangeRange( ERangeAccent, EPeninputVkbLayoutAccented1 + 2 * index, ETrue );
|
|
1896 |
}
|
|
1897 |
UpdateRangeCtrlsL();
|
|
1898 |
}
|
|
1899 |
|
|
1900 |
// ---------------------------------------------------------------------------
|
|
1901 |
// Get resource ids of range button icon
|
|
1902 |
// ---------------------------------------------------------------------------
|
|
1903 |
//
|
|
1904 |
void CPeninputSplitQwertyWindow::GetRangeIconResource( TInt aLangId,
|
|
1905 |
TInt& aAlphaRange,
|
|
1906 |
TInt& aOtherRange )
|
|
1907 |
{
|
|
1908 |
switch ( aLangId )
|
|
1909 |
{
|
|
1910 |
case ELangRussian: //Cyrillic
|
|
1911 |
case ELangBulgarian:
|
|
1912 |
case ELangUkrainian:
|
|
1913 |
{
|
|
1914 |
aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_CYRILLIC_ALPHA;
|
|
1915 |
aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_CYRILLIC_NUMERIC;
|
|
1916 |
}
|
|
1917 |
break;
|
|
1918 |
case ELangGreek: //Greek
|
|
1919 |
case ELangCyprusGreek:
|
|
1920 |
{
|
|
1921 |
aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_GREEK_ALPHA;
|
|
1922 |
aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_GREEK_NUMERIC;
|
|
1923 |
}
|
|
1924 |
break;
|
|
1925 |
case ELangHebrew: //Hebrew
|
|
1926 |
{
|
|
1927 |
aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_HEBREW_ALPHA;
|
|
1928 |
aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_HEBREW_NUMERIC;
|
|
1929 |
}
|
|
1930 |
break;
|
|
1931 |
case ELangArabic: //Arabic
|
|
1932 |
case ELangFarsi: //Farsi
|
|
1933 |
case ELangUrdu: //Urdu
|
|
1934 |
{
|
|
1935 |
aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_ARABIC_ALPHA;
|
|
1936 |
aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_ARABIC_NUMERIC;
|
|
1937 |
}
|
|
1938 |
break;
|
|
1939 |
case ELangThai: //Thai
|
|
1940 |
{
|
|
1941 |
aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_THAI_ALPHA;
|
|
1942 |
aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_THAI_NUMERIC;
|
|
1943 |
}
|
|
1944 |
break;
|
|
1945 |
default: //others
|
|
1946 |
{
|
|
1947 |
aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_LATIN_ALPHA;
|
|
1948 |
aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_LATIN_NUMERIC;
|
|
1949 |
}
|
|
1950 |
}
|
|
1951 |
}
|
|
1952 |
|
|
1953 |
// ---------------------------------------------------------------------------
|
|
1954 |
// Prepare range list items
|
|
1955 |
// ---------------------------------------------------------------------------
|
|
1956 |
//
|
|
1957 |
void CPeninputSplitQwertyWindow::PrepareRangeListItems(
|
|
1958 |
RArray<CFepLayoutChoiceList::SItem>& aRangeItems )
|
|
1959 |
{
|
|
1960 |
aRangeItems.Reset();
|
|
1961 |
TInt currentRange = IntContext( EPeninputDataTypeCurrentRange );
|
|
1962 |
TInt permittedRange = IntContext( EPeninputDataTypePermittedRange );
|
|
1963 |
TInt currentAccent = IntContext( EPeninputDataTypeCurrentAccent );
|
|
1964 |
TInt currentLanguage = IntContext( EPeninputDataTypeInputLanguage );
|
|
1965 |
|
|
1966 |
CPeninputRangeBarInfo* rbinfo= ConfigInfo()->RangeBarInfo();
|
|
1967 |
CPeninputRangeInfo* rgninfo = NULL;
|
|
1968 |
|
|
1969 |
//add accent items
|
|
1970 |
if ( permittedRange & ERangeAccent )
|
|
1971 |
{
|
|
1972 |
rgninfo = rbinfo->FindRange( ERangeAccent );
|
|
1973 |
if ( rgninfo )
|
|
1974 |
{
|
|
1975 |
for ( TInt i = 0; i < iAccentCmdList.Count(); i++ )
|
|
1976 |
{
|
|
1977 |
if( currentRange != ERangeAccent || currentAccent != i )
|
|
1978 |
{
|
|
1979 |
aRangeItems.Append( iAccentCmdList[i] );
|
|
1980 |
}
|
|
1981 |
}
|
|
1982 |
}
|
|
1983 |
}
|
|
1984 |
|
|
1985 |
//add range items
|
|
1986 |
|
|
1987 |
CFepLayoutChoiceList::SItem item;
|
|
1988 |
|
|
1989 |
if ( permittedRange & ERangeNative )
|
|
1990 |
{
|
|
1991 |
rgninfo = rbinfo->FindRange( ERangeNative );
|
|
1992 |
if ( rgninfo && currentRange != ERangeNative )
|
|
1993 |
{
|
|
1994 |
item.iCommand = EPeninputVkbLayoutNativeChar;
|
|
1995 |
item.iText.Copy( iRangeLabels.iLabelNativeChar );
|
|
1996 |
aRangeItems.Append( item );
|
|
1997 |
}
|
|
1998 |
}
|
|
1999 |
|
|
2000 |
if (( permittedRange & ERangeNativeNumber ) && ( currentRange != ERangeNumber )
|
|
2001 |
&& (( ELangArabic == currentLanguage ) || ( ELangFarsi == currentLanguage )
|
|
2002 |
|| ( ELangUrdu == currentLanguage )))
|
|
2003 |
{
|
|
2004 |
rgninfo = rbinfo->FindRange( ERangeNativeNumber );
|
|
2005 |
if ( rgninfo && currentRange != ERangeNativeNumber )
|
|
2006 |
{
|
|
2007 |
item.iCommand = EPeninputVkbLayoutNativeNumber;
|
|
2008 |
item.iText.Copy( iRangeLabels.iLabelNativeNumber );
|
|
2009 |
aRangeItems.Append( item );
|
|
2010 |
}
|
|
2011 |
}
|
|
2012 |
else if(( permittedRange & ERangeNumber ) && ( currentRange != ERangeNumber )
|
|
2013 |
&& !(( ELangThai == currentLanguage ) && ( currentRange == ERangeNativeNumber )))
|
|
2014 |
{
|
|
2015 |
rgninfo = rbinfo->FindRange( ERangeNumber );
|
|
2016 |
if ( rgninfo && currentRange != ERangeNumber )
|
|
2017 |
{
|
|
2018 |
item.iCommand = EPeninputVkbLayoutLatinNumber;
|
|
2019 |
item.iText.Copy( iRangeLabels.iLabelLatinNumber );
|
|
2020 |
aRangeItems.Append( item );
|
|
2021 |
}
|
|
2022 |
}
|
|
2023 |
else
|
|
2024 |
{
|
|
2025 |
// Do nothing
|
|
2026 |
}
|
|
2027 |
|
|
2028 |
if ( permittedRange & ERangeEnglish )
|
|
2029 |
{
|
|
2030 |
rgninfo = rbinfo->FindRange( ERangeEnglish );
|
|
2031 |
if ( rgninfo && currentRange != ERangeEnglish )
|
|
2032 |
{
|
|
2033 |
item.iCommand = EPeninputVkbLayoutLatinChar;
|
|
2034 |
item.iText.Copy( iRangeLabels.iLabelLatinChar );
|
|
2035 |
aRangeItems.Append( item );
|
|
2036 |
}
|
|
2037 |
}
|
|
2038 |
}
|
|
2039 |
|
|
2040 |
void CPeninputSplitQwertyWindow::HandleRangeButtonShortPress()
|
|
2041 |
{
|
|
2042 |
const TInt range = CPeninputDataConverter::AnyToInt(
|
|
2043 |
iLayoutContext->RequestData(EPeninputDataTypeCurrentRange));
|
|
2044 |
|
|
2045 |
const TInt langId = CPeninputDataConverter::AnyToInt(
|
|
2046 |
iLayoutContext->RequestData(EPeninputDataTypeInputLanguage));
|
|
2047 |
|
|
2048 |
switch ( langId )
|
|
2049 |
{
|
|
2050 |
case ELangRussian:
|
|
2051 |
case ELangBulgarian:
|
|
2052 |
case ELangUkrainian:
|
|
2053 |
{
|
|
2054 |
range == ERangeNative ? ChangeRange( ERangeNumber ) : ChangeRange( ERangeNative );
|
|
2055 |
}
|
|
2056 |
break;
|
|
2057 |
|
|
2058 |
case ELangArabic:
|
|
2059 |
case ELangFarsi:
|
|
2060 |
case ELangUrdu:
|
|
2061 |
{
|
|
2062 |
range == ERangeNative ? ChangeRange( ERangeNativeNumber ) : ChangeRange( ERangeNative );
|
|
2063 |
}
|
|
2064 |
break;
|
|
2065 |
|
|
2066 |
case ELangThai:
|
|
2067 |
{
|
|
2068 |
range == ERangeNative ? ChangeRange( ERangeNumber ) : ChangeRange( ERangeNative );
|
|
2069 |
}
|
|
2070 |
break;
|
|
2071 |
|
|
2072 |
case ELangGreek:
|
|
2073 |
case ELangHebrew:
|
|
2074 |
{
|
|
2075 |
range == ERangeNative ? ChangeRange( ERangeNumber ) : ChangeRange( ERangeNative );
|
|
2076 |
}
|
|
2077 |
break;
|
|
2078 |
default: // Latin, vietnamese, and other possible languages
|
|
2079 |
{
|
|
2080 |
if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeNative ) )
|
|
2081 |
{
|
|
2082 |
if ( range == ERangeNative )
|
|
2083 |
{
|
|
2084 |
if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeNativeNumber ) )
|
|
2085 |
{
|
|
2086 |
ChangeRange( ERangeNativeNumber );
|
|
2087 |
}
|
|
2088 |
else if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeNumber ) )
|
|
2089 |
{
|
|
2090 |
ChangeRange( ERangeNumber );
|
|
2091 |
}
|
|
2092 |
}
|
|
2093 |
else
|
|
2094 |
{
|
|
2095 |
ChangeRange( ERangeNative );
|
|
2096 |
}
|
|
2097 |
}
|
|
2098 |
else if ( ConfigInfo()->RangeBarInfo()->FindRange( ERangeEnglish ) )
|
|
2099 |
{
|
|
2100 |
range == ERangeEnglish ? ChangeRange( ERangeNumber ) : ChangeRange( ERangeEnglish );
|
|
2101 |
}
|
|
2102 |
}
|
|
2103 |
break;
|
|
2104 |
}
|
|
2105 |
|
|
2106 |
TRAP_IGNORE( UpdateRangeCtrlsL() );
|
|
2107 |
}
|
|
2108 |
|
|
2109 |
// End Of File
|