Kmxsip_adapter.c
20.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
#include "MMI_features.h"
#include "kmx_input_config.h"
#ifdef __MMI_KMX_TOUCH_INPUT__
/* MTK related start */
#include "MMI_features.h"
#include "Gui.h"
#include "gdi_include.h"
#include "wgui_categories_util.h"
#include "wgui_categories_inputs.h"
#include "ImeGprot.h"
#include "Imc.h"
#include "Imui.h"
#include "Imc_key.h"
#include "Wgui_ems.h"
#include "font_engine_interface.h"
#include "kmxsip_config.h"
/* To be replaced */
#include "Mmi_rp_app_komoxo_def.h"
#include "kmximmapi.h"
#include "kmxsip_adapter.h"
#include "Kmxsip_keypad.h"
#include "Komoxo_logo.h"
#include "kmx_input_prot.h"
#include "kmx_image_id.h"
#include "TimerEvents.h"
#include "kmx_gui.h"
#define KMX_LABEL_FONT (&MMI_small_font)
#define KMX_TEXT_FONT (&MMI_default_font)
#define KMX_LABEL_TEXT_COLOR (KMX_GUI_MAKE_COLOR(0, 0, 0))
static KMX_GUI_COLOR convert_color(KMX_COLOR c)
{
return KMX_GUI_MAKE_COLOR(KMX_COLOR_RED(c), KMX_COLOR_GREEN(c), KMX_COLOR_BLUE(c));
}
static void mtk_get_string_width_height_n(U8* s, S32 len, S32* pwidth, S32* pheight)
{
#if defined(__MMI_VECTOR_FONT_SUPPORT__) && !defined(__MMI_SCRIPT_EASY__)
mmi_fe_get_string_info_param_struct query;
memset(&query, 0, sizeof(mmi_fe_get_string_info_param_struct));
query.String = s;
query.n = len;
query.enableTruncated = MMI_FALSE;
mmi_fe_get_string_widthheight(&query);
*pwidth = query.adv_w;
*pheight = Get_CharHeight();
#else
Get_StringWidthHeight((U8 *)s, pwidth, pheight);
#endif
}
static void mtk_get_string_width_height(U8* s, S32* pwidth, S32* pheight)
{
mtk_get_string_width_height_n(s, kmx_gui_strlen((unsigned short*)s), pwidth, pheight);
}
/*********************************************************************************
*
* Draw Button Image and Label.
*
*********************************************************************************/
extern BOOL r2lMMIFlag;
extern BOOL cancelWidth;
static void draw_button_label(
int keypad_x,
int keypad_y,
const KMX_BUTTON* button)
{
S32 width, height;
int x, y;
KMX_GUI_COLOR c;
#ifdef __MMI_VECTOR_FONT_SUPPORT__
static stFontAttribute text_font;
#endif
if (!button->label_text)
return;
MMI_ASSERT(button->label_font_size != 0);
#ifdef __MMI_VECTOR_FONT_SUPPORT__
text_font.size = KMX_GUI_MAKE_VF_SIZE(button->label_font_size);
gui_set_font(&text_font);
#else
gui_set_font(KMX_LABEL_FONT);
#endif
mtk_get_string_width_height((U8*)button->label_text, &width, &height);
if (button->label_flags & KMX_LABEL_HCENTER)
x = button->x + (button->width - width) / 2;
else if (button->label_flags & KMX_LABEL_RTL)
x = button->x + button->width - width - button->label_x;
else
x = button->x + button->label_x;
x += keypad_x;
if (button->label_flags & KMX_LABEL_VCENTER)
y = button->y + (button->height - height) / 2;
else
y = button->y + button->label_y;
y += keypad_y;
gui_push_text_clip();
gui_set_text_clip(x, y, keypad_x + button->x + button->width, keypad_y + button->y + button->height);
if (button->label_color == 0xFFFFFF)
{
c = KMX_LABEL_TEXT_COLOR;
}
else
{
c = convert_color(button->label_color);
}
if (r2lMMIFlag && !cancelWidth)
{
x = x + width - 1;
}
#ifdef __MMI_VECTOR_FONT_SUPPORT__
kmx_gui_draw_text(x, y, KMX_GUI_MAKE_VF_SIZE(button->label_font_size), button->label_text, kmx_gui_strlen(button->label_text), c);
#else
kmx_gui_draw_text(x, y, KMX_LABEL_FONT->size, button->label_text, kmx_gui_strlen(button->label_text), c);
#endif
gui_pop_text_clip();
}
static void kmx_highlight_button(
KEYPAD* keypad,
const KMX_BUTTON* button)
{
}
#define KMX_IMAGE_HIGHLIGHT_ID_OFFSET (HIGHLIGHT_IMG_KOMOXO_COMMON_N - IMG_KOMOXO_COMMON_N)
static PU8 kmx_mtk_get_image(U16 image_id, int is_highlight_image)
{
int low = 0, mid, high = sizeof(g_kmx_image_range_table) / (2 * sizeof(g_kmx_image_range_table[0]));
while(low <= high)
{
mid = (low + high) >> 1;
if (image_id >= g_kmx_image_range_table[mid * 2] && image_id <= g_kmx_image_range_table[mid * 2 + 1])
{
image_id = (unsigned short)(image_id - g_kmx_image_range_table[mid * 2] + g_kmx_image_map_table[mid]);
if (is_highlight_image)
image_id = (unsigned short)(image_id + KMX_IMAGE_HIGHLIGHT_ID_OFFSET);
return get_image(image_id);
}
else if (image_id < g_kmx_image_range_table[mid * 2])
{
high = mid - 1;
}
else
{
low = mid + 1;
}
}
return NULL;
}
static void draw_button_image(
KEYPAD * keypad,
const KMX_BUTTON* buttons,
int num_buttons)
{
int i;
int keypad_x = keypad->x;
int keypad_y = keypad->y;
for (i = 0; i < num_buttons; i++)
{
const KMX_BUTTON * button;
PU8 image_buffer;
button = &buttons[i];
/* Do not Draw Zero Width Button */
if(button->width && button->height)
{
image_buffer = kmx_mtk_get_image(button->image, button->extra_flags & KMX_BUTTON_EXTRA_FLAG_HIGHLIGHT);
kmx_gui_draw_image(keypad_x + button->x, keypad_y + button->y, image_buffer);
if (button->extra_flags & KMX_BUTTON_EXTRA_FLAG_HIGHLIGHT)
{
kmx_highlight_button(keypad, button);
}
}
}
}
void mtk_keypad_draw_button(
KEYPAD* keypad,
const KMX_BUTTON* buttons,
int num_buttons)
{
int i;
if (!keypad)
return;
draw_button_image(keypad, buttons, num_buttons);
for (i = 0; i < num_buttons; i++)
draw_button_label(keypad->x, keypad->y, &buttons[i]);
}
/*********************************************************************************
*
* Hide and Show Echo Button.
*
*********************************************************************************/
#ifndef KMX_CFG_DISABLE_ECHO
#define KMX_MAX_ECHO_BUTTON_HEIGHT 50
#define KMX_ECHO_WINDOW_Y 130
#define KMX_LAYER_BUF_SIZE (240 * KMX_MAX_ECHO_BUTTON_HEIGHT * 2)
#if defined(__ARM9_MMU__) && defined(__MTK_TARGET__)
#pragma arm section zidata = "NONCACHEDZI"
static int kmx_layer_buf[KMX_LAYER_BUF_SIZE / 4];
#pragma arm section zidata
#else
static int kmx_layer_buf[KMX_LAYER_BUF_SIZE / 4];
#endif
static gdi_handle kmx_echo_button_layer;
#define KMX_MAX_LAYER_COUNT 4
static int kmx_select_layer(gdi_handle layer)
{
gdi_handle layers[KMX_MAX_LAYER_COUNT];
int i;
memset(layers, 0, sizeof(gdi_handle) * KMX_MAX_LAYER_COUNT);
gdi_layer_get_blt_layer(&layers[0], &layers[1], &layers[2], &layers[3]);
for (i = 0; i < KMX_MAX_LAYER_COUNT; i ++)
{
/* already selected */
if (layers[i] == layer)
{
return i + 1;
}
}
for (i = 0; i < KMX_MAX_LAYER_COUNT; i ++)
{
if (layers[i] == GDI_LAYER_EMPTY_HANDLE || layers[i] == GDI_ERROR_HANDLE)
{
layers[i] = layer;
break;
}
}
/* layer was full, can not select more layer */
if (i == KMX_MAX_LAYER_COUNT)
return 0;
/* select the layer */
gdi_layer_blt(layers[0], layers[1], layers[2], layers[3], 0, 0, 1, 1);
return i + 1;
}
static void kmx_deselect_layer(gdi_handle layer)
{
gdi_handle layers[KMX_MAX_LAYER_COUNT];
int i;
memset(layers, 0, sizeof(gdi_handle) * KMX_MAX_LAYER_COUNT);
gdi_layer_get_blt_layer(&layers[0], &layers[1], &layers[2], &layers[3]);
for (i = 0; i < KMX_MAX_LAYER_COUNT; i ++)
{
if (layers[i] == layer)
{
layers[i] = GDI_LAYER_EMPTY_HANDLE;
break;
}
}
/* layer not found, do nothing */
if (i == KMX_MAX_LAYER_COUNT)
return;
/* deselect the layer */
gdi_layer_blt(layers[0], layers[1], layers[2], layers[3], 0, 0, 1, 1);
return;
}
void mtk_create_echo_layer(void)
{
gdi_layer_create_using_outside_memory(0, KMX_ECHO_WINDOW_Y, 240, KMX_MAX_ECHO_BUTTON_HEIGHT, &kmx_echo_button_layer, (unsigned char *)kmx_layer_buf, KMX_LAYER_BUF_SIZE);
}
void mtk_destory_echo_layer(void)
{
kmx_deselect_layer(kmx_echo_button_layer);
gdi_layer_free(kmx_echo_button_layer);
kmx_echo_button_layer = 0;
}
void mtk_keypad_echo_button(
KEYPAD* keypad,
const KMX_BUTTON* button)
{
KMX_RECT r;
int x, y;
if (!kmx_echo_button_layer)
return;
if (button)
{
keypad->echo_button = *button;
keypad->echo_button.x = 0;
keypad->echo_button.y = 0;
// default to metric 240
x = (240 - keypad->echo_button.width) / 2;
y = KMX_ECHO_WINDOW_Y;
r.left = x;
r.top = y;
r.right = x + keypad->echo_button.width;
r.bottom = y + keypad->echo_button.height;
gdi_layer_push_and_set_active(kmx_echo_button_layer);
gdi_layer_reset_clip();
gui_lock_double_buffer();
gdi_layer_clear(GDI_COLOR_BLUE);
gdi_layer_set_source_key(TRUE, GDI_COLOR_BLUE);
draw_button_image(x, 0, &keypad->echo_button, 1);
draw_button_label(x, 0, &keypad->echo_button);
gui_unlock_double_buffer();
kmx_select_layer(kmx_echo_button_layer);
gdi_layer_blt_previous(r.left, r.top, r.right, r.bottom);
gdi_layer_pop_and_restore_active();
//kmx_deselect_layer(kmx_echo_button_layer);
}
else
{
x = (240 - keypad->echo_button.width) / 2;
y = KMX_ECHO_WINDOW_Y;
r.left = x;
r.top = y;
r.right = r.left + keypad->echo_button.width;
r.bottom = r.top + keypad->echo_button.height;
gdi_layer_push_and_set_active(kmx_echo_button_layer);
gdi_layer_reset_clip();
gdi_layer_clear(GDI_COLOR_BLUE);
gdi_layer_pop_and_restore_active();
kmx_select_layer(kmx_echo_button_layer);
gdi_layer_blt_previous(r.left, r.top, r.right, r.bottom);
//kmx_deselect_layer(kmx_echo_button_layer);
}
}
#else
void mtk_create_echo_layer(void)
{
}
void mtk_destory_echo_layer(void)
{
}
void mtk_keypad_echo_button(
KEYPAD* keypad,
const KMX_BUTTON* button)
{
}
#endif
static U32 __inline mtk_keypad_imc_send_message(U8 msg_id, int param_0, int param_1)
{
mmi_imc_message_struct msg;
msg.message_id = msg_id;
msg.param_0 = (U32)param_0;
msg.param_1 = (U32)param_1;
return mmi_ime_sdk_send_editor_msg(&msg);
}
/*********************************************************************************
*
* Get Context in Editor
*
*********************************************************************************/
#define KMX_IS_PTR_WORD_ALIGNED(p) (!((unsigned int)(p) & 1))
#define KMX_MAX_CONTEXT_BUFFER_LENGTH 64
void mtk_keypad_get_context(
KEYPAD* keypad,
KMX_CONTEXT* context)
{
U8 *text_start = NULL, *text_end = NULL;
if(!keypad || !context)
return;
context->flags = 0;
context->text_length = 0;
context->caret_position = 0;
context->flags = KMX_FLAG_COMP_SUPPORT;
keypad->support_composition = TRUE;
/* !We can only get text ptr before caret. */
mtk_keypad_imc_send_message(MMI_IMC_MESSAGE_GET_TEXT_PTR_BEFORE_CANDIDATE, (int)&text_start, (int)&text_end);
if (!text_start || !text_end || text_start > text_end)
return;
context->text_length = (text_end - text_start) / 2;
/* Check parameters */
if (!context->text_buffer || !context->text_buffer_length)
return;
if (context->text_length > context->text_buffer_length)
context->text_length = context->text_buffer_length;
memcpy(context->text_buffer, text_end - context->text_length * sizeof(KMX_WCHAR), context->text_length * sizeof(KMX_WCHAR));
/* !Caret position is the pointer points the next character after caret char */
context->caret_position = context->text_length;
}
/*********************************************************************************
*
* Draw colored rectangle.
*
*********************************************************************************/
void mtk_keypad_draw_rect(
KEYPAD* keypad,
int left,
int top,
int right,
int bottom,
KMX_COLOR c)
{
KMX_GUI_RECT r;
r.left = keypad->x + left;
r.top = keypad->y + top;
r.right = keypad->x + right;
r.bottom = keypad->y + bottom;
kmx_gui_draw_rect(&r, convert_color(c));
}
/*********************************************************************************
*
* Draw Background rectangle.
*
*********************************************************************************/
void mtk_keypad_draw_background(
KEYPAD* keypad,
int left,
int top,
int right,
int bottom)
{
KMX_GUI_RECT r;
r.left = keypad->x + left;
r.top = keypad->y + top;
r.right = keypad->x + right;
r.bottom = keypad->y + bottom;
kmx_gui_draw_rect(&r, convert_color(DEFAULT_BK_COLOR));
}
/*********************************************************************************
*
* Draw Text.
*
*********************************************************************************/
void mtk_keypad_get_text_size(
KEYPAD* keypad,
const KMX_WCHAR* text,
int length,
int font_size,
int* width,
int* height);
void mtk_keypad_draw_text(
KEYPAD* keypad,
int x,
int y,
const KMX_WCHAR* text,
int length,
int font_size,
KMX_COLOR c)
{
if (r2lMMIFlag && !cancelWidth)
{
int width;
mtk_keypad_get_text_size(keypad, text, length, font_size, &width, 0);
x = x + width - 1;
}
#ifdef __MMI_VECTOR_FONT_SUPPORT__
kmx_gui_draw_text(keypad->x + x, keypad->y + y,
KMX_GUI_MAKE_VF_SIZE(font_size),
text, length,
convert_color(c));
#else
kmx_gui_draw_text(keypad->x + x, keypad->y + y,
KMX_TEXT_FONT->size,
text, length,
convert_color(c));
#endif
}
/*********************************************************************************
*
* Get Text Size.
*
*********************************************************************************/
void mtk_keypad_get_text_size(
KEYPAD* keypad,
const KMX_WCHAR* text,
int length,
int font_size,
int* width,
int* height)
{
int w, h;
#ifdef __MMI_VECTOR_FONT_SUPPORT__
static stFontAttribute text_font;
#endif
#ifdef __MMI_VECTOR_FONT_SUPPORT__
text_font.size = KMX_GUI_MAKE_VF_SIZE(font_size);
gui_set_font(&text_font);
#else
gui_set_font(KMX_TEXT_FONT);
#endif
mtk_get_string_width_height_n((U8 *)text, length, &w, &h);
if (width)
*width = w;
if (height)
*height = h;
}
/*********************************************************************************
*
* Timer.
*
*********************************************************************************/
extern void kmx_timer_handler(void * arg);
/* KMX TEMP HANDLE */
#define KMX_UI_TIMER_1 CSTAR_REQ_TIMER
#define KMX_UI_TIMER_2 CSTAR_FRAME_TIMER
void mtk_keypad_set_timer(
KEYPAD* keypad,
int timer_id,
int time)
{
if(!keypad)
return;
switch(timer_id) {
case KMX_TIMER_1:
if (keypad->is_timer1_actived)
{
StopTimer(KMX_UI_TIMER_1);
keypad->is_timer1_actived = 0;
}
if (time > 0)
{
StartTimerEx(KMX_UI_TIMER_1, time, kmx_timer_handler, (void *)KMX_TIMER_1);
keypad->is_timer1_actived = 1;
}
break;
case KMX_TIMER_2:
if (keypad->is_timer2_actived)
{
StopTimer(KMX_UI_TIMER_2);
keypad->is_timer2_actived = 0;
}
if (time > 0)
{
StartTimerEx(KMX_UI_TIMER_2, time, kmx_timer_handler, (void *)KMX_TIMER_2);
keypad->is_timer2_actived = 1;
}
break;
}
}
static void mtk_keypad_cancel_multitap_timer(
KEYPAD* keypad,
int cancel_insertion)
{
if (!keypad)
return;
if (keypad->is_timer2_actived)
{
if (cancel_insertion)
keypad->is_cancel_insertion = 1;
kmx_timer_handler((void *)KMX_TIMER_2);
if (cancel_insertion)
keypad->is_cancel_insertion = 0;
StopTimer(KMX_UI_TIMER_2);
keypad->is_timer2_actived = 0;
}
}
void mtk_keypad_stop_all_timer(void)
{
StopTimer(KMX_UI_TIMER_1);
StopTimer(KMX_UI_TIMER_2);
}
/*********************************************************************************
*
* Notification Handler
*
*********************************************************************************/
extern int kmx_is_input_mode_multitap(mmi_imm_input_mode_enum input_mode);
static void mtk_keypad_end_comp(KEYPAD* keypad)
{
if (keypad->comp_text_length > 0)
{
#ifdef KMX_CFG_MULTITAP_INPUT
if(kmx_is_input_mode_multitap(keypad->last_input_mode) && keypad->comp_text_length == 1)
{
mtk_keypad_imc_send_message(MMI_IMC_MESSAGE_RESET_MULTITAP_STATE, 0, 0);
mtk_keypad_imc_send_message(MMI_IMC_MESSAGE_STOP_SMART_ALPHABETIC, 0, 0);
}
else
#endif
{
mtk_keypad_imc_send_message(MMI_IMC_MESSAGE_CLEAR_HILIGHT, 0, 0);
}
keypad->comp_text_length = 0;
}
}
static void mtk_keypad_clear_comp(KEYPAD* keypad)
{
if (keypad->comp_text_length > 0)
{
#ifdef KMX_CFG_MULTITAP_INPUT
if(kmx_is_input_mode_multitap(keypad->last_input_mode))
{
mtk_keypad_imc_send_message(MMI_IMC_MESSAGE_RESET_MULTITAP_STATE, 0, 0);
mtk_keypad_imc_send_message(MMI_IMC_MESSAGE_STOP_SMART_ALPHABETIC, 0, 0);
mtk_keypad_imc_send_message(MMI_IMC_MESSAGE_DELETE_CHAR, 1, 0);
}
else
#endif
mtk_keypad_imc_send_message(MMI_IMC_MESSAGE_REPLACE_HIGHLIGHT_STRING, keypad->comp_text_length, (int)L"");
keypad->comp_text_length = 0;
}
else
{
/* Force clear highlight */
mtk_keypad_imc_send_message(MMI_IMC_MESSAGE_CLEAR_HILIGHT, 0, 0);
}
}
static void mtk_keypad_set_comp(KEYPAD* keypad, const UI_character_type *text, int length)
{
#ifdef KMX_CFG_MULTITAP_INPUT
if(kmx_is_input_mode_multitap(keypad->last_input_mode) && length == 1)
{
if(keypad->comp_text_length == 0)
{
mtk_keypad_imc_send_message(MMI_IMC_MESSAGE_START_SMART_ALPHABETIC, 0, 0);
}
if(!mtk_keypad_imc_send_message(MMI_IMC_MESSAGE_INSERT_MULTITAP_CHAR, (int)text[0], 0))
{
/* can not set composition 2009-12-17 */
if (keypad->comp_text_length == 0)
{
mtk_keypad_imc_send_message(MMI_IMC_MESSAGE_STOP_SMART_ALPHABETIC, 0, 0);
mtk_keypad_cancel_multitap_timer(keypad, 1);
}
return;
}
}
else
#endif
{
int highlighted_length;
mtk_keypad_clear_comp(keypad);
highlighted_length = (int)mtk_keypad_imc_send_message(MMI_IMC_MESSAGE_REPLACE_HIGHLIGHT_STRING, keypad->comp_text_length, (int)text);
if (highlighted_length < length)
{
/* Editor is full. Cancel highlight. */
keypad->comp_text_length = 0;
mtk_keypad_imc_send_message(MMI_IMC_MESSAGE_CLEAR_HILIGHT, 0, 0);
keypad_reset(keypad);
return;
}
}
keypad->comp_text_length = length;
}
int mtk_keypad_notify_editor(KEYPAD* keypad, KMX_NOTIFY_MSG_CODE code, int param1, int param2)
{
switch(code)
{
case KMX_NOTIFY_MSG_END_IME_COMP:
mtk_keypad_end_comp(keypad);
break;
case KMX_NOTIFY_MSG_CLEAR_IME_COMP:
mtk_keypad_clear_comp(keypad);
break;
case KMX_NOTIFY_MSG_SET_IME_COMP:
mtk_keypad_set_comp(keypad, (const UI_character_type*)param1, param2);
break;
}
return 1;
}
#endif /* #ifdef __MMI_KMX_TOUCH_INPUT__ */