FSEditorCui.c 110 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 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072
/*****************************************************************************
*  Copyright Statement:
*  --------------------
*  This software is protected by Copyright and the information contained
*  herein is confidential. The software may not be copied and the information
*  contained herein may not be used or disclosed except with the written
*  permission of MediaTek Inc. (C) 2005
*
*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
*
*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/

/*******************************************************************************
 * Filename:
 * ---------
 *  FSEditorCui.c
 *
 * Project:
 * --------
 *  MAUI
 *
 * Description:
 * ------------
 *  
 *
 * Author:
 * -------
 * -------
 *
 *==============================================================================
 *             HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
 *------------------------------------------------------------------------------
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 * removed!
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
 *==============================================================================
 *******************************************************************************/

//#include "MMI_include.h"
#include "FSEditorCui.h"
#include "FSEditorCuiGprot.h"
#include "CommonScreensResDef.h"        /* SCR_FSEDITOR ID */
//#include "CommonScreens.h"
#include "MenuCuiGprot.h"
#include "mmi_rp_srv_editor_def.h"
//#include "mmi_rp_menu_misc_def.h"

    #include "gui_data_types.h"
    #include "MMIDataType.h"
    #include "mmi_frm_scenario_gprot.h"
    #include "kal_general_types.h"
    #include "gui_inputs.h"
    #include "MMI_fw_trc.h"
    #include "mmi_fw_trc.h"
    #include "DebugInitDef_Int.h"
    #include "kal_trace.h"
    #include "kal_public_api.h"
    #include "GlobalResDef.h"
    #include "ImeGprot.h"
    #include "wgui_categories_list.h"
    #include "mmi_frm_events_gprot.h"
    #include "wgui_categories_inputs.h"
    #include "wgui_inputs.h"
    #include "wgui_categories_util.h"
    #include "GlobalConstants.h"
    #include "MMI_features.h"
    #include "gdi_include.h"
    #include "gui.h"
    #include "gui_config.h"
    #include "lcd_sw_inc.h"
    #include "Gui_Setting.h"
    #include "CustDataRes.h"
    #include "CustMenuRes.h"
    #include "string.h"
    #include "wgui_title.h"
    #include "gui_title.h"
    #include "wgui_include.h"
    #include "Unicodexdcl.h"
    #include "gui_typedef.h"
#ifdef __MMI_NCENTER_SUPPORT__
    #include "vapp_ncenter_gprot.h"
#endif
/***************************************************************************** 
*  Define
*****************************************************************************/
#define CUI_FSEDITOR_MAX_INSTANCE_COUNT      3
#define CUI_FSEDITOR_DEFAULT_LSK_TEXT        STR_GLOBAL_OPTIONS
#define CUI_FSEDITOR_DEFAULT_LSK_ICON        IMG_GLOBAL_OPTIONS
#define CUI_FSEDITOR_DEFAULT_RSK_TEXT        STR_GLOBAL_BACK
#define CUI_FSEDITOR_DEFAULT_RSK_ICON        IMG_GLOBAL_BACK
#define CUI_FSEDITOR_DEFAULT_CSK_TEXT        0
#define CUI_FSEDITOR_DEFAULT_CSK_ICON        IMG_GLOBAL_COMMON_CSK
#define CUI_FSEDITOR_DEFAULT_OPTIONS_DONE    STR_GLOBAL_DONE
#define CUI_FSEDITOR_DEFAULT_OPTIONS_CANCEL  STR_GLOBAL_CANCEL
#define CUI_FSEDITOR_MAX_OPTION_ITEMS        20

/***************************************************************************** 
*  Typedef 
*****************************************************************************/

/***************************************************************************** 
*  Extern Variables
*****************************************************************************/
/* store label string of RSK of input box */
extern UI_string_type wgui_inputbox_RSK_label_string;

/* store label icon of RSK key */
extern PU8 wgui_inputbox_RSK_label_icon;

/***************************************************************************** 
*  Global Variables
*****************************************************************************/

/*****************************************************************************  
*  Local Variables 
*****************************************************************************/
#ifndef FSEditor_CUI_MEMORY_FROM_ASM
static cui_fseditor_struct g_cui_fseditor_data[CUI_FSEDITOR_MAX_INSTANCE_COUNT];
#endif

#ifdef FSEditor_CUI_MEMORY_FROM_ASM
cui_fseditor_asm_instance_struct g_cui_FSEditor_asm_instance[CUI_FSEDITOR_MAX_INSTANCE_COUNT];
#endif 

static mmi_id g_fseditor_gid = 0;
static mmi_id g_opt_menu_gid, g_opt_menu_id;

/*****************************************************************************  
*   Local Functions  
*****************************************************************************/
static void cui_fseditor_init(mmi_id fseditor_gid);
static mmi_ret cui_fseditor_proc(mmi_event_struct *evt);
static void cui_fseditor_lsk_handler(void);
static void cui_fseditor_rsk_handler(void);
static void cui_fseditor_csk_handler(void);
static void cui_fseditor_scr_entry(mmi_scrn_essential_struct* info);
static void cui_fseditor_entry_options_screen(void);
#ifdef FSEditor_CUI_MEMORY_FROM_ASM
static cui_fseditor_struct *cui_fseditor_get_data(mmi_id app_id,KAL_ADM_ID app_adm_id,U16* memory_p);
static void cui_fseditor_free_data(cui_fseditor_struct *editor);
#else /*FSEditor_CUI_MEMORY_FROM_ASM*/
static cui_fseditor_struct *cui_fseditor_get_data(void);
#endif
static WCHAR* cui_fseditor_malloc_text_buffer(mmi_id fseditor_gid, S32 buffer_size);
static MMI_BOOL cui_fseditor_edit_change_event_handler(gui_multi_line_input_box_change_event_enum event, U16 c);
static void cui_fseditor_options_done_handler(void);
static void cui_fseditor_options_cancel_handler(void);
static void cui_fseditor_options_custom_menu_handler(mmi_menu_id menu_id);
static void cui_fseditor_change_buffer(mmi_id fseditor_gid);
static mmi_ret cui_fseditor_options_menu_handler(mmi_menu_id menu_id);

/* Event handler */
static void cui_fseditor_evt_submit(void);
static void cui_fseditor_evt_abort(void);
static void cui_fseditor_evt_empty(void);
static void cui_fseditor_evt_not_empty(void);
static MMI_BOOL cui_fseditor_evt_delete_char(U16 c);
static MMI_BOOL cui_fseditor_evt_insert_char(U16 c);
static void cui_fseditor_evt_changed(void);
static void cui_fseditor_evt_validation(PU8 text, PU8 cursor_position, S32 text_length);
static void cui_fseditor_evt_set_key(void);
static void cui_fseditor_evt_custom_options_menu_select(mmi_menu_id menu_id);
static void cui_fseditor_evt_csk_pressed(void);
static void cui_fseditor_evt_input_method_change(void);


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_init
 * DESCRIPTION
 *  Init full screen editor CUI structure and set default value
 * PARAMETERS
 *  fseditor_gid        [IN]        Full screen editor CUI group ID
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_init(mmi_id fseditor_gid)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_TRACE(MMI_FW_TRC_G4_EDITOR, MMI_GUI_EDITOR_CUI_INIT, fseditor_gid);
    MMI_ASSERT(editor != NULL);
    editor->lsk_label = CUI_FSEDITOR_DEFAULT_LSK_TEXT;
    editor->lsk_icon = CUI_FSEDITOR_DEFAULT_LSK_ICON;
    editor->rsk_label = CUI_FSEDITOR_DEFAULT_RSK_TEXT;
    editor->rsk_icon = CUI_FSEDITOR_DEFAULT_RSK_ICON;
    editor->csk_label = CUI_FSEDITOR_DEFAULT_CSK_TEXT;
    editor->csk_icon = CUI_FSEDITOR_DEFAULT_CSK_ICON;
    editor->input_type = IMM_INPUT_TYPE_SENTENCE;
    editor->options_done_label = CUI_FSEDITOR_DEFAULT_OPTIONS_DONE;
    editor->options_cancel_label = CUI_FSEDITOR_DEFAULT_OPTIONS_CANCEL;
    editor->state = CUI_FSEDITOR_STATE_CREATE;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_proc
 * DESCRIPTION
 *  full screen editor CUI proc function.
 * PARAMETERS
 *  evt     [IN]        Event structure
 * RETURNS
 *  mmi_ret
 *****************************************************************************/
static mmi_ret cui_fseditor_proc(mmi_event_struct *evt)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor;
    cui_fseditor_evt_struct editor_evt;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (evt->evt_id)
    {
    case EVT_ID_GROUP_DEINIT:

        // notify app
        MMI_FRM_INIT_GROUP_EVENT(&editor_evt, EVT_ID_CUI_FSEDITOR_DEINIT, g_fseditor_gid);  
        mmi_frm_group_send_to_parent(g_fseditor_gid, (mmi_group_event_struct*)&editor_evt);

        /* release resource, e.g. instance memory */
        editor = (cui_fseditor_struct*)evt->user_data;
        MMI_ASSERT(editor != NULL);
#ifdef FSEditor_CUI_MEMORY_FROM_ASM

        cui_fseditor_free_data(editor);
        
#else /*FSEditor_CUI_MEMORY_FROM_ASM*/
        
        editor->memory_id = 0;
#endif
        break;
#ifdef __MMI_NCENTER_SUPPORT__
    case EVT_ID_VAPP_NCENTER_DRAG:
    	  {
            editor = (cui_fseditor_struct*)evt->user_data;
            MMI_ASSERT(editor != NULL);
    	      if (editor->is_disable_ncenter)
    	      {
    	      	 return MMI_RET_ERR;
    	      }
    	  }
		  break;
#endif
    default:
        break;
    }
    return MMI_RET_OK;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_scr_entry
 * DESCRIPTION
 *  Full screen editor CUI entry function
 * PARAMETERS
 *  info          [IN]
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_scr_entry(mmi_scrn_essential_struct* info)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 *guiBuffer;
    mmi_id fseditor_gid;
    cui_fseditor_struct *editor;
    mmi_imm_input_mode_enum input_mode;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    fseditor_gid = g_fseditor_gid = info->group_id;
    editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);
    MMI_TRACE(MMI_FW_TRC_G4_EDITOR, MMI_GUI_EDITOR_CUI_SCRN_ENTRY, fseditor_gid);
    MMI_ASSERT(editor != NULL);

    if (mmi_frm_scrn_enter(fseditor_gid, SCR_FSEDITOR, NULL, (FuncPtr)cui_fseditor_scr_entry, MMI_FRM_FULL_SCRN) == MMI_FALSE)
    {
        return;
    }

    if (editor->buffer == NULL)
    {
        /* Current we don't support. It's just for future extension */
        MMI_ASSERT(0);
        editor->buffer = cui_fseditor_malloc_text_buffer(fseditor_gid, editor->buffer_size);
    }

    /* Get gui buffer */
    guiBuffer = (PU8)mmi_frm_scrn_get_gui_buf(fseditor_gid, SCR_FSEDITOR);
    editor->editor_scr_id = SCR_FSEDITOR;

    if (editor->set_characters_list)
    {
        mmi_imm_set_characters(editor->set_characters_flag, editor->set_characters_list);
    }

    if (editor->is_title_in_header)
    {
        wgui_cat5_set_title_in_header(1);
    }

    /* Register editor callback */
    wgui_inputs_register_empty_func(cui_fseditor_evt_empty);
    wgui_inputs_register_not_empty_func(cui_fseditor_evt_not_empty);
    wgui_inputs_register_validation_func(cui_fseditor_evt_validation);
    wgui_inputs_register_input_method_change_func(cui_fseditor_evt_input_method_change);

    if (editor->buffer_change_flag)
    {
        if (guiBuffer)
        {
            /* retrieve last time input type */
            input_mode = (((multiline_inputbox_category_history*)guiBuffer)->ime_history).input_mode;
            mmi_imm_set_app_desired_input_mode(input_mode);
            guiBuffer = NULL;
            editor->buffer_change_flag = MMI_FALSE;
        }
    }

    if (editor->title_string)
    {
        ShowCategory5Screen_ext2(
            (UI_string_type)editor->title_string,
            get_image(editor->title_icon),
            get_string(editor->lsk_label),
            get_image(editor->lsk_icon),
            get_string(editor->rsk_label),
            get_image(editor->rsk_icon),
            editor->input_type,
            (PU8)editor->buffer,
            editor->edit_length + 1,
            guiBuffer,
            editor->input_ext_type,
            (mmi_imm_input_mode_enum *)editor->required_input_mode_set);
    }
    else
    {
        ShowCategory5Screen_ext(
            editor->title,
            editor->title_icon,
            editor->lsk_label,
            editor->lsk_icon,
            editor->rsk_label,
            editor->rsk_icon,
            editor->input_type,
            (PU8)editor->buffer,
            editor->edit_length + 1,
            guiBuffer,
            editor->input_ext_type,
            (mmi_imm_input_mode_enum *)editor->required_input_mode_set);
    }

    if (guiBuffer == NULL && editor->set_cursor_first_pos)
    {
        wgui_inputs_ml_move_cursor(WGUI_INPUTS_CURSOR_POS_START);
    }

    if (editor->is_auto_display_counter)
    {
        wgui_inputs_ml_set_auto_display_remaining_counter();
        wgui_inputs_ml_redraw();
    }

    if (editor->is_delete_all)
    {
        wgui_inputs_ml_set_clear_key_delete_all_mode();
    }

    /* Set change callback after show category because it will reset in showcategory */
    MMI_multiline_inputbox.change_callback = cui_fseditor_evt_changed;
    wgui_inputs_ml_register_change_event_handler(cui_fseditor_edit_change_event_handler);

    SetLeftSoftkeyFunction(cui_fseditor_lsk_handler, KEY_EVENT_UP);
    SetCategory5RightSoftkeyFunction(cui_fseditor_rsk_handler, KEY_EVENT_UP);
//#ifndef __OP01_FWPBW__
    ChangeCenterSoftkey(editor->csk_label, editor->csk_icon);
//#endif
    SetCenterSoftkeyFunction(cui_fseditor_csk_handler, KEY_EVENT_UP);

    cui_fseditor_evt_set_key();
    editor->state = CUI_FSEDITOR_STATE_RUN;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_lsk_handler
 * DESCRIPTION
 *  full screen editor CUI left softkey hanlder. If app set the LSK, it will send submit
 *  event to app when user press lsk, else, it will entry editor options screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_lsk_handler(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(g_fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_ASSERT(editor != NULL);
    if (editor->lsk_change_flag)
    {
        cui_fseditor_evt_submit();
    }
    else
    {
        cui_fseditor_entry_options_screen();
    }
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_rsk_handler
 * DESCRIPTION
 *  full screen editor CUI right softkey hanlder, it will send abort event to app
 *  when user press rsk
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_rsk_handler(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    cui_fseditor_evt_abort();
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_csk_handler
 * DESCRIPTION
 *  full screen editor CUI center softkey hanlder. If app set the CSK, it will send csk pressed
 *  event to app when user press csk, else, it will entry editor options screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_csk_handler(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(g_fseditor_gid);
    mmi_menu_id menu_id = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_ASSERT(editor != NULL);
    if (editor->csk_change_flag)
    {
        cui_fseditor_evt_csk_pressed();
    }
    else
    {
        if (!editor->disable_def_opt_menu_flag)
        {
            menu_id = MENU_ID_EDITOR_CUI_OPT_DONE;
            cui_fseditor_options_menu_handler(menu_id);
        }
        else if (editor->options_cust_menu_list)
        {
            menu_id = editor->options_cust_menu_list[0];
            cui_fseditor_options_menu_handler(menu_id);
        }
        else
        {
            menu_id = MENU_ID_EDITOR_CUI_OPT_CANCEL;
            cui_fseditor_options_menu_handler(menu_id);
        }
    }
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_options_done_handler
 * DESCRIPTION
 *  full screen editor CUI options Done menu hanlder. It will be invoked when user
 *  select Done menu item and press LSK
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_options_done_handler(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* Go back history */

    cui_fseditor_evt_submit();
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_options_cancel_handler
 * DESCRIPTION
 *  full screen editor CUI options Cancel menu hanlder. It will be invoked when user
 *  select Cancel menu item and press LSK
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_options_cancel_handler(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* Go back history */

    cui_fseditor_evt_abort();
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_options_custom_menu_handler
 * DESCRIPTION
 *  full screen editor CUI options Custom menu hanlder. It will be invoked when user
 *  select Custom menu item and press LSK
 * PARAMETERS
 *  menu_id          [IN]             custom menu id
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_options_custom_menu_handler(mmi_menu_id menu_id)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* Go back history */

    cui_fseditor_evt_custom_options_menu_select(menu_id);
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_change_buffer
 * DESCRIPTION
 *  Change editor buffer and redraw. 
 *  Internal function, used by cui_fseditor_set_text
 * PARAMETERS
 *  fseditor_gid          [IN]        group id
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_change_buffer(mmi_id fseditor_gid)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 l;
    S32 saved_flags, saved_ext_flags;
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (editor == NULL)
    {
        return;
    }

    gdi_layer_lock_frame_buffer();

#ifdef __MMI_TOUCH_SCREEN__
    gui_multi_line_input_box_scroll_timer_hdlr();
#endif 

    saved_flags = MMI_multiline_inputbox.flags;
    saved_ext_flags = MMI_multiline_inputbox.ext_flags;

    l = gui_strlen((UI_string_type) editor->buffer);

    gui_create_multi_line_input_box_set_buffer(
        &MMI_multiline_inputbox,
        MMI_multiline_inputbox.x,
        MMI_multiline_inputbox.y,
        MMI_multiline_inputbox.width,
        MMI_multiline_inputbox.height,
        (UI_string_type) editor->buffer,
        (editor->edit_length + 1) * ENCODING_LENGTH,
        (l + 1) * 2,
        l);

    MMI_multiline_inputbox.flags = saved_flags;
    MMI_multiline_inputbox.ext_flags = saved_ext_flags;

    if (editor->input_type & INPUT_TYPE_USE_ENCODING_BASED_LENGTH)
    {
        MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH;
        if (editor->input_type & INPUT_TYPE_ONE_LESS_CHARACTER)
        {
            MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_ONE_LESS_CHARACTER;
            UI_TEST_UCS2_COUNT_SET_LENGTH_TYPE2(
                MMI_multiline_inputbox.UCS2_count,
                MMI_multiline_inputbox.allocated_length,
                MMI_multiline_inputbox.available_length);
        }
        else if (editor->input_type & INPUT_TYPE_FORTY_FOUR_LESS_CHARACTER)
        {
            MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_FORTY_FOUR_LESS_CHARACTER;
            UI_TEST_UCS2_COUNT_SET_LENGTH_TYPE3(
                MMI_multiline_inputbox.UCS2_count,
                MMI_multiline_inputbox.allocated_length,
                MMI_multiline_inputbox.available_length);
        }
        else
        {
            UI_TEST_UCS2_COUNT_SET_LENGTH(
                MMI_multiline_inputbox.UCS2_count,
                MMI_multiline_inputbox.allocated_length,
                MMI_multiline_inputbox.available_length);
        }
    }

#ifdef __MMI_WALLPAPER_ON_BOTTOM__ 
    MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_TRANSPARENT_BACKGROUND;
#endif

    wgui_inputs_ml_show_with_information_bar();
    gdi_layer_unlock_frame_buffer();

    gdi_layer_blt_previous(0, 0, MAIN_LCD_DEVICE_WIDTH, MAIN_LCD_DEVICE_HEIGHT);
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_add_options_menu_item
 * DESCRIPTION
 *  Edtior Options screen entry function
 * PARAMETERS
 *  info        [IN]
 * RETURNS
 *  void
 *****************************************************************************/
static mmi_ret cui_fseditor_add_options_menu_item(mmi_menu_id sender_id)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor;
    mmi_menu_id root_ids[CUI_FSEDITOR_MAX_OPTION_ITEMS];
    U8 index = 0;
    U8 i;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(g_fseditor_gid);

    if (editor == NULL)
    {
        return MMI_RET_ERR;
    }

    /* Done/Cancel menu item */
    if (!editor->disable_def_opt_menu_flag)
    {
        root_ids[index++] = MENU_ID_EDITOR_CUI_OPT_DONE;
    }

    /* App's menu item */
    if (editor->options_cust_menu_list)
    {
        for (i = 0; i < editor->options_cust_menu_count; i++)
        {
            root_ids[index++] = editor->options_cust_menu_list[i];
        }
    }

    if (!editor->disable_cancel_item)
    {
        root_ids[index++] = MENU_ID_EDITOR_CUI_OPT_CANCEL;
    }

    /* Input method related menu item */
    root_ids[index++] = MENU_ID_EDIT_OPTS;

    cui_menu_set_currlist(sender_id, index, root_ids);

    /* Set menu item string */
    for (i = 0; i < index; i++)
    {
            cui_menu_set_item_string(sender_id,
                root_ids[i], (UI_string_type)GetString(GetStringIdOfItem(root_ids[i])));
    }

    return MMI_RET_OK;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_is_custom_menu
 * DESCRIPTION
 *  Check if menu id is custom menu id or not
 * PARAMETERS
 *  menu_id        [IN]
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
static MMI_BOOL cui_fseditor_is_custom_menu(mmi_menu_id menu_id)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor;
    U8 i = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(g_fseditor_gid);

    if (editor == NULL)
    {
       return MMI_FALSE;
    }

    if (editor->options_cust_menu_list)
    {
        for (i = 0; i < editor->options_cust_menu_count; i++)
        {
            if (editor->options_cust_menu_list[i] == menu_id)
            {
                return MMI_TRUE;
            }
        }
    }

    return MMI_FALSE;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_options_menu_handler
 * DESCRIPTION
 *  Edtior Options screen entry function
 * PARAMETERS
 *  info        [IN]
 * RETURNS
 *  void
 *****************************************************************************/
static mmi_ret cui_fseditor_options_menu_handler(mmi_menu_id menu_id)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (menu_id == MENU_ID_EDITOR_CUI_OPT_DONE)
    {
        cui_fseditor_options_done_handler();
    }
    else if (menu_id == MENU_ID_EDITOR_CUI_OPT_CANCEL)
    {
        cui_fseditor_options_cancel_handler();
    }
    else if (cui_fseditor_is_custom_menu(menu_id))
    {
        cui_fseditor_options_custom_menu_handler(menu_id);
    }

    return MMI_RET_OK;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_options_proc
 * DESCRIPTION
 *  Edtior Options screen entry function
 * PARAMETERS
 *  info        [IN]
 * RETURNS
 *  void
 *****************************************************************************/
static mmi_ret cui_fseditor_options_proc(mmi_event_struct *evt)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_menu_event_struct *menu_evt = (cui_menu_event_struct*)evt;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (menu_evt->evt_id)
    {
        case EVT_ID_CUI_MENU_LIST_ENTRY:
            if (MENU_ID_EDITOR_CUI_OPT == menu_evt->parent_menu_id)
            {
                cui_fseditor_add_options_menu_item(menu_evt->sender_id);
            }
            break;
        case EVT_ID_CUI_MENU_ITEM_TAP:
        case EVT_ID_CUI_MENU_ITEM_CSK_SELECT:
        case EVT_ID_CUI_MENU_ITEM_SELECT:
            cui_fseditor_options_menu_handler(menu_evt->highlighted_menu_id);
            break;
        case EVT_ID_CUI_MENU_CLOSE_REQUEST:
            cui_menu_close(menu_evt->sender_id);
            break;
    }

    if (cui_menu_is_menu_event(menu_evt->evt_id))
    {
        wgui_inputs_options_menu_handler(evt, g_fseditor_gid);
    }
    return MMI_RET_OK;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_entry_options_screen
 * DESCRIPTION
 *  Edtior Options screen entry function
 * PARAMETERS
 *  info        [IN]
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_entry_options_screen()
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(g_fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (editor == NULL)
    {
        return;
    }

    g_opt_menu_gid = mmi_frm_group_create(
        g_fseditor_gid, GRP_ID_AUTO_GEN, cui_fseditor_options_proc, (void*)NULL); 

    MMI_TRACE(MMI_FW_TRC_G4_EDITOR, MMI_GUI_EDITOR_CUI_OPTION_SCRN_ENTRY, g_opt_menu_gid, g_fseditor_gid);

    mmi_frm_group_enter(g_opt_menu_gid, MMI_FRM_NODE_SMART_CLOSE_FLAG);
    
    g_opt_menu_id = cui_menu_create(g_opt_menu_gid,
        CUI_MENU_SRC_TYPE_APPCREATE,
        CUI_MENU_TYPE_OPTION,
        MENU_ID_EDITOR_CUI_OPT,
        MMI_FALSE, NULL);
    cui_menu_set_default_title(g_opt_menu_id, (WCHAR*)GetString(STR_GLOBAL_OPTIONS), (UI_image_type)GetImage(editor->title_icon));
    cui_menu_run(g_opt_menu_id);
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_get_data
 * DESCRIPTION
 *  Get Full screen instance data, currently we use global memory and the max instance
 *  is defined in MAX_CUI_FSEDITOR_INSTANCE_COUNT. We can improve this by using ADM
 * PARAMETERS
 *  void
 * RETURNS
 *  instance data point
 *****************************************************************************/

#ifdef FSEditor_CUI_MEMORY_FROM_ASM

static cui_fseditor_struct *cui_fseditor_get_data(mmi_id app_id,KAL_ADM_ID app_adm_id,U16* memory_p)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    int i = 0;
    cui_fseditor_create_info is_create_bp = CUI_FS_EDITOR_NOT_CREATE; 
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    //int j = sizeof(cui_fseditor_asm_instance_struct);
#ifdef FSEditor_CUI_ASM_DEBUG_TRACE
    kal_prompt_trace(MOD_MMI_FW, "FSEditor CUI get memory start---------------------------------- \n");

    for (i = 0; i < CUI_FSEDITOR_MAX_INSTANCE_COUNT; i++)
    {
        kal_prompt_trace(MOD_MMI_FW, "FSEditor CUI get memory check INFO i: %d , address: %x ,APP ID: %d ,ADM ID: %d,is_create: %d \n", 
                  i,
                  g_cui_FSEditor_asm_instance[i].cui_fseditor_instance,
                  g_cui_FSEditor_asm_instance[i].app_id,
                  g_cui_FSEditor_asm_instance[i].app_adm_id,
                  g_cui_FSEditor_asm_instance[i].is_create);
    }
#endif
    
    
    for (i = 0; i < CUI_FSEDITOR_MAX_INSTANCE_COUNT; i++)
    {
        if (g_cui_FSEditor_asm_instance[i].is_create == CUI_FS_EDITOR_NOT_CREATE)
        {   
            
#ifdef FSEditor_CUI_ASM_DEBUG_TRACE
            if(g_cui_FSEditor_asm_instance[i].cui_fseditor_instance)
            {
                kal_prompt_trace(MOD_MMI_FW, "FSEditor CUI NOT free memory from ASM i: %d ,address: %x ,APP ID: %d \n", 
                            i,g_cui_FSEditor_asm_instance[i].cui_fseditor_instance,g_cui_FSEditor_asm_instance[i].app_id);
            }    
#endif            
            if(app_id)
            {
                g_cui_FSEditor_asm_instance[i].cui_fseditor_instance = applib_asm_alloc_r(app_id,FSEditor_DATA_ASM_SIZE);
                g_cui_FSEditor_asm_instance[i].app_id = (mmi_id)app_id;
                is_create_bp = CUI_FS_EDITOR_CREATE_WITH_ASM;
            }
            else
            {   
                if((!app_id)&&(!app_adm_id)&&(!memory_p))
                {
                    g_cui_FSEditor_asm_instance[i].cui_fseditor_instance = applib_asm_alloc_r(ASM_ANONYMOUS_ID,FSEditor_DATA_ASM_SIZE); 
                    g_cui_FSEditor_asm_instance[i].app_id = (mmi_id)ASM_ANONYMOUS_ID;
                    is_create_bp = CUI_FS_EDITOR_CREATE_WITH_ASM;
                }
                else if(app_adm_id)
                {
                    g_cui_FSEditor_asm_instance[i].cui_fseditor_instance = kal_adm_alloc(app_adm_id,FSEditor_DATA_ASM_SIZE); 
                    g_cui_FSEditor_asm_instance[i].app_adm_id = (KAL_ADM_ID)app_adm_id;                    
                    is_create_bp = CUI_FS_EDITOR_CREATE_WITH_ADM;
                }
                else if(memory_p)
                {
                    g_cui_FSEditor_asm_instance[i].cui_fseditor_instance = (cui_fseditor_struct*)memory_p; 
                    is_create_bp = CUI_FS_EDITOR_CREATE_WITH_MEMORY_POINT;
                }

            }
            if(g_cui_FSEditor_asm_instance[i].cui_fseditor_instance)
            {    
                memset(g_cui_FSEditor_asm_instance[i].cui_fseditor_instance, 0, FSEditor_DATA_ASM_SIZE);
                
                g_cui_FSEditor_asm_instance[i].is_create= is_create_bp;
                g_cui_FSEditor_asm_instance[i].cui_fseditor_instance->memory_id = 1;

#ifdef FSEditor_CUI_ASM_DEBUG_TRACE
                kal_prompt_trace(MOD_MMI_FW, "FSEditor CUI get memory from ASM i: %d ,address: %x ,APP ID: %d ,ADM ID: %d,Size:%d Success\n", 
                                 i,
                                 g_cui_FSEditor_asm_instance[i].cui_fseditor_instance,
                                 g_cui_FSEditor_asm_instance[i].app_id,
                                 g_cui_FSEditor_asm_instance[i].app_adm_id,
                                 FSEditor_DATA_ASM_SIZE);

                kal_prompt_trace(MOD_MMI_FW, "FSEditor CUI get memory end---------------------------------- \n");
#endif


                return g_cui_FSEditor_asm_instance[i].cui_fseditor_instance;
            }
            g_cui_FSEditor_asm_instance[i].app_id = 0;
            g_cui_FSEditor_asm_instance[i].app_adm_id = 0;
            break;
        }
    }
#ifdef FSEditor_CUI_ASM_DEBUG_TRACE
    kal_prompt_trace(MOD_MMI_FW, "FSEditor CUI get memory from ASM address:   no get memory \n");
    kal_prompt_trace(MOD_MMI_FW, "FSEditor CUI get memory end-----------------00000----------------- \n");
#endif
    
    return NULL;
}

static void cui_fseditor_free_data(cui_fseditor_struct *editor)
{
        /*----------------------------------------------------------------*/
        /* Local Variables                                                */
        /*----------------------------------------------------------------*/
        int i = 0;
    
        /*----------------------------------------------------------------*/
        /* Code Body                                                      */
        /*----------------------------------------------------------------*/
            
#ifdef FSEditor_CUI_ASM_DEBUG_TRACE
             kal_prompt_trace(MOD_MMI_FW, "FSEditor CUI free memory start--------------------input editorP:%x \n",editor);
    
             for (i = 0; i < CUI_FSEDITOR_MAX_INSTANCE_COUNT; i++)
             {
                 kal_prompt_trace(MOD_MMI_FW, "FSEditor CUI free memory check INFO i: %d , address: %x ,APP ID: %d ,is_create: %d \n", 
                                   i,
                                   g_cui_FSEditor_asm_instance[i].cui_fseditor_instance,
                                   g_cui_FSEditor_asm_instance[i].app_id,
                                   g_cui_FSEditor_asm_instance[i].is_create);
             }
#endif
    
        for (i = 0; i < CUI_FSEDITOR_MAX_INSTANCE_COUNT; i++)
        {
            if (g_cui_FSEditor_asm_instance[i].cui_fseditor_instance == editor)
            {   
                if((g_cui_FSEditor_asm_instance[i].cui_fseditor_instance)&&(g_cui_FSEditor_asm_instance[i].is_create))
                {    
                    
#ifdef FSEditor_CUI_ASM_DEBUG_TRACE
                    kal_prompt_trace(MOD_MMI_FW, "FSEditor CUI free memory from ASM i: %d ,address: %x , APP ID: %d ,is_create: %d Success\n",
                                      i, 
                                      g_cui_FSEditor_asm_instance[i].cui_fseditor_instance,
                                      g_cui_FSEditor_asm_instance[i].app_id,
                                      g_cui_FSEditor_asm_instance[i].is_create);
#endif
                    if(g_cui_FSEditor_asm_instance[i].is_create == CUI_FS_EDITOR_CREATE_WITH_ASM)
                    {
                        applib_asm_free_r(g_cui_FSEditor_asm_instance[i].app_id, g_cui_FSEditor_asm_instance[i].cui_fseditor_instance);
                    }
                    else if(g_cui_FSEditor_asm_instance[i].is_create == CUI_FS_EDITOR_CREATE_WITH_ADM)
                    {
                        kal_adm_free(g_cui_FSEditor_asm_instance[i].app_adm_id, g_cui_FSEditor_asm_instance[i].cui_fseditor_instance);
                    }
                    g_cui_FSEditor_asm_instance[i].is_create= 0;  
                    g_cui_FSEditor_asm_instance[i].app_id = 0;
                    g_cui_FSEditor_asm_instance[i].app_adm_id = 0;
                    g_cui_FSEditor_asm_instance[i].cui_fseditor_instance = NULL;
                     
                }
            }
        }
        
#ifdef FSEditor_CUI_ASM_DEBUG_TRACE
            kal_prompt_trace(MOD_MMI_FW, "FSEditor CUI free memory end---------------------------------- \n");
#endif
    
    
}


#else /* FSEditor_CUI_MEMORY_FROM_ASM */
static cui_fseditor_struct *cui_fseditor_get_data(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 index = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    for (index = 0; index < CUI_FSEDITOR_MAX_INSTANCE_COUNT; index++)
    {
        if (g_cui_fseditor_data[index].memory_id == 0)
        {
            memset(&g_cui_fseditor_data[index], 0, sizeof(cui_fseditor_struct));
            g_cui_fseditor_data[index].memory_id = index + 1;
            return &g_cui_fseditor_data[index];
        }
    }

    return NULL;
}
#endif 


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_malloc_text_buffer
 * DESCRIPTION
 *  Malloc fseditor text buffer
 * PARAMETERS
 *  fseditor_gid        [IN]        Full screen edtior CUI group ID created by parent
 * RETURNS
 *  void
 *****************************************************************************/
static WCHAR* cui_fseditor_malloc_text_buffer(mmi_id fseditor_gid, S32 buffer_size)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* For future useage */
    return NULL;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_edit_change_event_handler
 * DESCRIPTION
 *  Full screen editor CUI change event handler.
 *  It will be invoke before a char to be inserted/deleted
 * PARAMETERS
 *  event       [IN]        GUI_MULTI_LINE_INPUT_BOX_INSERT_CHAR/GUI_MULTI_LINE_INPUT_BOX_DELETE_CHAR
 *  c           [IN]        Char to be inserted or deleted
 * RETURNS
 *  MMI_BOOL:
 *  MMI_TRUE:  allow to change (delete/inserted)
 *  MMI_FALSE: not allow to change (delete/inserted)
 *****************************************************************************/
static MMI_BOOL cui_fseditor_edit_change_event_handler(gui_multi_line_input_box_change_event_enum event, U16 c)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (event == GUI_MULTI_LINE_INPUT_BOX_INSERT_CHAR)
    {
        return cui_fseditor_evt_insert_char(c);
    }
    else if (event == GUI_MULTI_LINE_INPUT_BOX_DELETE_CHAR)
    {
        return cui_fseditor_evt_delete_char(c);
    }

    return MMI_TRUE;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_evt_submit
 * DESCRIPTION
 *  FSEditor CUI submit event handler
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_evt_submit(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_evt_struct evt;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_FRM_INIT_GROUP_EVENT(&evt, EVT_ID_CUI_FSEDITOR_SUBMMIT, g_fseditor_gid);
    mmi_frm_group_send_to_parent(g_fseditor_gid, (mmi_group_event_struct*) & evt);
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_evt_abort
 * DESCRIPTION
 *  FSEditor CUI abort event handler
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_evt_abort(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_evt_struct evt;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_FRM_INIT_GROUP_EVENT(&evt, EVT_ID_CUI_FSEDITOR_ABORT, g_fseditor_gid);
    mmi_frm_group_send_to_parent(g_fseditor_gid, (mmi_group_event_struct*) & evt);
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_evt_empty
 * DESCRIPTION
 *  FSEditor CUI empty event handler
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_evt_empty(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_evt_struct evt;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_FRM_INIT_GROUP_EVENT(&evt, EVT_ID_CUI_FSEDITOR_EMPTY, g_fseditor_gid);
    mmi_frm_group_post_to_parent(g_fseditor_gid, (mmi_group_event_struct*) & evt);
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_evt_not_empty
 * DESCRIPTION
 *  FSEditor CUI not empty event handler
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_evt_not_empty(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_evt_struct evt;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_FRM_INIT_GROUP_EVENT(&evt, EVT_ID_CUI_FSEDITOR_NOT_EMPTY, g_fseditor_gid);
    mmi_frm_group_post_to_parent(g_fseditor_gid, (mmi_group_event_struct*) & evt);
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_evt_insert_char
 * DESCRIPTION
 *  FSEditor CUI insert event handler
 * PARAMETERS
 *  c       [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
static MMI_BOOL cui_fseditor_evt_insert_char(U16 c)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_edit_evt_struct evt;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_FRM_INIT_GROUP_EVENT(&evt, EVT_ID_CUI_FSEDITOR_INSERT_CHAR, g_fseditor_gid);
    evt.c = c;
    mmi_frm_group_send_to_parent(g_fseditor_gid, (mmi_group_event_struct*) & evt);
    return MMI_TRUE;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_evt_delete_char
 * DESCRIPTION
 *  FSEditor CUI delete event handler
 * PARAMETERS
 *  c       [IN]        Character to be deleted
 * RETURNS
 *  void
 *****************************************************************************/
static MMI_BOOL cui_fseditor_evt_delete_char(U16 c)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_edit_evt_struct evt;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_FRM_INIT_GROUP_EVENT(&evt, EVT_ID_CUI_FSEDITOR_DELETE_CHAR, g_fseditor_gid);
    evt.c = c;
    mmi_frm_group_send_to_parent(g_fseditor_gid, (mmi_group_event_struct*) & evt);
    return MMI_TRUE;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_evt_changed
 * DESCRIPTION
 *  FSEditor CUI validation handler
 * PARAMETERS
 *  text                [IN]        Text buffer
 *  cursor_position     [IN]        Cursor position
 *  text_length         [IN]        Text length
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_evt_validation(PU8 text, PU8 cursor_position, S32 text_length)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_change_evt_struct evt;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_FRM_INIT_GROUP_EVENT(&evt, EVT_ID_CUI_FSEDITOR_VALIDATION, g_fseditor_gid);
    evt.text = text;
    evt.cursor_position = cursor_position;
    evt.text_length = text_length;
    mmi_frm_group_send_to_parent(g_fseditor_gid, (mmi_group_event_struct*) & evt);
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_evt_changed
 * DESCRIPTION
 *  FSEditor CUI changed event handler
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_evt_changed(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_change_evt_struct evt;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_FRM_INIT_GROUP_EVENT(&evt, EVT_ID_CUI_FSEDITOR_CHANGED, g_fseditor_gid);
    evt.text = MMI_multiline_inputbox.text;
    evt.cursor_position = MMI_multiline_inputbox.cursor_p;
    evt.text_length = MMI_multiline_inputbox.text_length;
    mmi_frm_group_send_to_parent(g_fseditor_gid, (mmi_group_event_struct*) & evt);
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_evt_custom_options_menu_select
 * DESCRIPTION
 *  FSEditor CUI custom options menu selected event handler
 * PARAMETERS
 *  menu_id          [IN]          custom menu id
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_evt_custom_options_menu_select(mmi_menu_id menu_id)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_custom_menu_select_evt_struct evt;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_FRM_INIT_GROUP_EVENT(&evt, EVT_ID_CUI_FSEDITOR_CUSTOM_MENU_SELECTED, g_fseditor_gid);
    evt.menu_id = menu_id;
    mmi_frm_group_send_to_parent(g_fseditor_gid, (mmi_group_event_struct*) & evt);
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_evt_set_key
 * DESCRIPTION
 *  FSEditor CUI set key event handler, If App has apply FW new input handle routine,
 *  this event will be deleted in future
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_evt_set_key(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_evt_struct evt;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_FRM_INIT_GROUP_EVENT(&evt, EVT_ID_CUI_FSEDITOR_SET_KEY, g_fseditor_gid);
    mmi_frm_group_post_to_parent(g_fseditor_gid, (mmi_group_event_struct*) & evt);
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_evt_input_method_change
 * DESCRIPTION
 *  FSEditor CUI input method change event handler
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_evt_input_method_change(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_input_method_change_evt_struct evt;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_FRM_INIT_GROUP_EVENT(&evt, EVT_ID_CUI_FSEDITOR_INPUT_METHOD_CHANGE, g_fseditor_gid);
    evt.input_method = mmi_imm_get_curr_input_mode();
    mmi_frm_group_post_to_parent(g_fseditor_gid, (mmi_group_event_struct*) & evt);
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_evt_csk_pressed
 * DESCRIPTION
 *  FSEditor CUI CSK pressed event handler
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void cui_fseditor_evt_csk_pressed(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_evt_struct evt;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_FRM_INIT_GROUP_EVENT(&evt, EVT_ID_CUI_FSEDITOR_CSK_PRESSED, g_fseditor_gid);
    mmi_frm_group_post_to_parent(g_fseditor_gid, (mmi_group_event_struct*) & evt);
}


/*****************************************************************************  
*   Extern Functions 
*****************************************************************************/


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_create
 * DESCRIPTION
 *  Create fsedtior CUI.
 *  WARNING: if max fseditor CUI instance number has reached, it will fail to 
 *           create CUI and return GRP_ID_INVALID.
 * PARAMETERS
 *  parent_gid      [IN]        App's Group ID
 * RETURNS
 *  FSeditor CUI group ID
 *****************************************************************************/
mmi_id cui_fseditor_create(mmi_id parent_gid)
{
#ifdef FSEditor_CUI_MEMORY_FROM_ASM

    return cui_fseditor_asm_create(parent_gid,NULL);

#else /*FSEditor_CUI_MEMORY_FROM_ASM*/     
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_id fseditor_gid = GRP_ID_INVALID;
    cui_fseditor_struct *instance_data;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    instance_data = cui_fseditor_get_data();
    if (instance_data != NULL)
    {
        fseditor_gid = mmi_frm_group_create(parent_gid, GRP_ID_AUTO_GEN, cui_fseditor_proc, instance_data);
        cui_fseditor_init(fseditor_gid);
    }
    else
    {
        /* Return Invalid group id if can't get instance data */
        fseditor_gid = GRP_ID_INVALID;
    }

    MMI_TRACE(MMI_FW_TRC_G4_EDITOR, MMI_GUI_EDITOR_CUI_CREATE, parent_gid, fseditor_gid);    
    return fseditor_gid;
#endif    
}

#ifdef FSEditor_CUI_MEMORY_FROM_ASM
mmi_id cui_fseditor_create_base(mmi_id parent_gid,mmi_id app_id,KAL_ADM_ID app_adm_id,U16* memory_p)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_id fseditor_gid = GRP_ID_INVALID;
    cui_fseditor_struct *instance_data;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    instance_data = cui_fseditor_get_data(app_id,app_adm_id,memory_p);
    if (instance_data != NULL)
    {
        fseditor_gid = mmi_frm_group_create(parent_gid, GRP_ID_AUTO_GEN, cui_fseditor_proc, instance_data);
        cui_fseditor_init(fseditor_gid);
    }
    else
    {
        /* Return Invalid group id if can't get instance data */
        fseditor_gid = GRP_ID_INVALID;
    }

    MMI_TRACE(MMI_FW_TRC_G4_EDITOR, MMI_GUI_EDITOR_CUI_CREATE, parent_gid, fseditor_gid);    
    return fseditor_gid;
}


mmi_id cui_fseditor_asm_create(mmi_id parent_gid,mmi_id app_id)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
  
    return cui_fseditor_create_base(parent_gid,app_id,NULL,NULL);
}


mmi_id cui_fseditor_adm_create(mmi_id parent_gid,KAL_ADM_ID app_adm_id)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
  
    return cui_fseditor_create_base(parent_gid,NULL,app_adm_id,NULL);
}


mmi_id cui_fseditor_mem_create(mmi_id parent_gid,U16* memory_p)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
  
    return cui_fseditor_create_base(parent_gid,NULL,NULL,memory_p);
}


#endif


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_run
 * DESCRIPTION
 *  FSeditor CUI run function. It will entry FSEditor screen after called it
 * PARAMETERS
 *  fseditor_gid        [IN]        FSEditor CUI Group ID
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_run(mmi_id fseditor_gid)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_TRACE(MMI_FW_TRC_G4_EDITOR, MMI_GUI_EDITOR_CUI_RUN, fseditor_gid);    
    mmi_frm_group_enter(fseditor_gid, MMI_FRM_NODE_NONE_FLAG);
    mmi_frm_scrn_first_enter(
            fseditor_gid,
            SCR_FSEDITOR, 
            (FuncPtr)cui_fseditor_scr_entry, 
            NULL);
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_close
 * DESCRIPTION
 *  FSEditor CUI close function. It will delete ALL Editor CUI's screen by calling it
 * PARAMETERS
 *  fseditor_gid        [IN]        FSEditor CUI Group ID
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_close(mmi_id fseditor_gid)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_TRACE(MMI_FW_TRC_G4_EDITOR, MMI_GUI_EDITOR_CUI_CLOSE, fseditor_gid);
    if (editor == NULL)
    {
        return;
    }

    /* close screen group */
    mmi_frm_group_close(fseditor_gid);
    if (g_fseditor_gid == fseditor_gid)
    {
        g_fseditor_gid = GRP_ID_INVALID;
    }
#ifndef FSEditor_CUI_MEMORY_FROM_ASM
    editor->state = CUI_FSEDITOR_STATE_CLOSE;
#endif
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_title
 * DESCRIPTION
 *  Set editor title by text resource ID and icon resource ID.
 * PARAMETERS
 *  fseditor_gid        [IN]        FSEditor CUI Group ID
 *  label               [IN]        Title text ID
 *  icon                [IN]        Title icon ID
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_title(mmi_id fseditor_gid, U16 label, U16 icon)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (editor == NULL)
    {
        return;
    }
    editor->title = label;
    editor->title_icon = icon;

    wgui_title_change(editor->title_icon, 0, (PU8)GetString(editor->title), WGUI_TITLE_CHANGE_ICON | WGUI_TITLE_CHANGE_TEXT);

    /* Change title only when editor CUI is running */
    if (editor->state == CUI_FSEDITOR_STATE_RUN)
    {
        wgui_title_show(GUI_TITLE_PART_ALL);
    }
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_title_string
 * DESCRIPTION
 *  Set editor title text by string.
 * PARAMETERS
 *  fseditor_gid        [IN]        FSEditor CUI Group ID
 *  label               [IN]        Title text string
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_title_string(mmi_id fseditor_gid, const WCHAR *label)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (editor == NULL)
    {
        return;
    }
    editor->title_string = label;

    wgui_title_change(0, 0, (PU8)editor->title_string, WGUI_TITLE_CHANGE_TEXT);

    /* Change title only when editor CUI is running */
    if (editor->state == CUI_FSEDITOR_STATE_RUN)
    {
        wgui_title_show(GUI_TITLE_PART_TEXT);
    }
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_title_icon
 * DESCRIPTION
 *  Set editor title icon ID.
 * PARAMETERS
 *  fseditor_gid        [IN]        FSEditor CUI Group ID
 *  icon                [IN]        Title icon ID
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_title_icon(mmi_id fseditor_gid, U16 icon)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (editor == NULL)
    {
        return;
    }
    editor->title_icon = icon;

    wgui_title_change(editor->title_icon, 0, NULL, WGUI_TITLE_CHANGE_ICON);

    /* Change title only when editor CUI is running */
    if (editor->state == CUI_FSEDITOR_STATE_RUN)
    {
        wgui_title_show(GUI_TITLE_PART_ICON);
    }
}

#if defined(__TOPWELL_MMI_INPUTBOX_SET_INPUT_METHOD__)
static MMI_BOOL g_topwell_inputbox_method_flag = MMI_FALSE;

void TOPWELL_MMI_INPUTBOX_SET_INPUT_METHOD(void)
{
    g_topwell_inputbox_method_flag =  MMI_TRUE;  
}

void TOPWELL_MMI_INPUTBOX_RESET_INPUT_METHOD(void)
{
    g_topwell_inputbox_method_flag =  MMI_FALSE;  
}
#endif

/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_input_method
 * DESCRIPTION
 *  Set editor input method
 *  NOTE: It should be called only before Editor CUI run
 * PARAMETERS
 *  fseditor_gid                [IN]        FSEditor CUI Group ID
 *  input_type                  [IN]        Input type
 *  required_input_mode_set     [IN]        App specific input mode list
 *  input_ext_type              [IN]        Input extention type
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_input_method(
        mmi_id fseditor_gid,
        U32 input_type,
        const mmi_imm_input_mode_enum *required_input_mode_set,
        S16 input_ext_type)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (editor == NULL)
    {
        return;
    }
	
   editor->input_type = input_type;
	
   #if defined(__TOPWELL_MMI_INPUTBOX_SET_INPUT_METHOD__)
    if(g_topwell_inputbox_method_flag == MMI_TRUE)	 //shuyi add
    	{
    	if (input_type == 1)
	{
       editor->input_type = 4;
    	}
    	}
   #endif

    editor->required_input_mode_set = required_input_mode_set;
    editor->input_ext_type = input_ext_type;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_text
 * DESCRIPTION
 *  Set FSEditor CUI buffer. It can be call before/after CUI run.
 *  [USAGE]:
 *    1. If edit buffer is smaller than CUI_FSEDITOR_MAX_BUFFER_SIZE, Editor CUI will use internal memory for editing
 *       1) If App pass NULL for buffer, Editor will use internal text buffer for edit and initialize it as empty text
 *       2) If App pass local text buffer, Editor will use internal text buffer for edit and copy the local text.
 *    2. If edit buffer is large than CUI_FSEDITOR_MAX_BUFFER_SIZE, App must pass the global/static memory for editing.
 *  [NOTE]: 
 *    1. When finish editing, App must call cui_fseditor_get_text to get text, no matter use app's buffer or editor CUI's buffer.
 *    2. If App call this function after CUI run, 
 *       1) If current screen is editor screen, It will refresh editor content by re entry editor screen
 *       2) If editor screen is in history, it won't refresh editor screen. And only set history buffer
 * PARAMETERS
 *  fseditor_gid        [IN]        FSEditor CUI Group ID
 *  buffer              [IN]        Editor Buffer
 *  buffer_size         [IN]        Editor buffer size in Bytes, including NULL terminal char
 *  edit_length         [IN]        Editor editable text length in character count, not including NULL terminal
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_text(mmi_id fseditor_gid, WCHAR *buffer, S32 buffer_size, S32 edit_length)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_TRACE(MMI_FW_TRC_G4_EDITOR, MMI_GUI_EDITOR_CUI_SET_TEXT, fseditor_gid, buffer_size, edit_length);
    if (editor == NULL)
    {
        return;
    }
    if (buffer_size <= CUI_FSEDITOR_MAX_BUFFER_SIZE)
    {
        if (buffer)
        {
            mmi_ucs2ncpy((S8*)editor->text_buffer, (S8*)buffer, (CUI_FSEDITOR_MAX_BUFFER_SIZE / 2 - 1));
        }
        editor->buffer = editor->text_buffer;
    }
    else
    {
        if (buffer)
        {
            editor->buffer = buffer;
        }
        else
        {
            /* App must use global/static memory for edit when size large than CUI_FSEDITOR_MAX_BUFFER_SIZE */
            MMI_ASSERT(0);
        }
    }
    editor->buffer_size = buffer_size;
    editor->edit_length = edit_length;

    /* Redraw editor only when editor CUI is running and current screen is editor screen */
    if (editor->state == CUI_FSEDITOR_STATE_RUN)
    {
        if (mmi_frm_scrn_get_active_id() == editor->editor_scr_id)
        {
            /* Update current screen buffer content and redraw screen */
            cui_fseditor_change_buffer(fseditor_gid);

            /* Set change callback after show category because it will reset after change buffer */
            MMI_multiline_inputbox.change_callback = cui_fseditor_evt_changed;
            wgui_inputs_ml_register_change_event_handler(cui_fseditor_edit_change_event_handler);
        }
        else
        {
            /* Discard history buffer by setting buffer change flag, so when entry editor screen, 
               history buffer will be discarded */
            editor->buffer_change_flag = MMI_TRUE;
        }
    }
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_get_text
 * DESCRIPTION
 *  Copy the edit text from FSEDITOR CUI to APP's buffer. 
 *  [NOTE]:
 *    1. After finish edit, App MUST call this API to get text, no matter use app's buffer or editor CUI's buffer
 *    2. App should guarantee the buffer_size of dest buffer is large enough to copy, if the editor text length is
 *       bigger than the buffer size, edit text will be truncated for app's buffer_size.
 * PARAMETERS
 *  fseditor_gid        [IN]         FSEditor CUI Group ID
 *  buffer              [OUT]        Buffer to copy edit content
 *  buffer_size         [IN]         buffer size to copy the edit content
 * RETURNS
 *  S32  real text length (character count) in editor buffer
 *****************************************************************************/
S32 cui_fseditor_get_text(mmi_id fseditor_gid, WCHAR *buffer, S32 buffer_size)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);
    S32 text_length;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_TRACE(MMI_FW_TRC_G4_EDITOR, MMI_GUI_EDITOR_CUI_GET_TEXT, fseditor_gid, buffer_size);
    /* Editor instance is not exist any more */
    if (editor == NULL)
    {
        return 0;
    }
    MMI_ASSERT(buffer != NULL); /* App must pass the dest buffer for copy */
    
    text_length = mmi_ucs2strlen((S8*)editor->buffer);

    /* App must pass enough dest buffer for copy, otherwise, text will be truncated */
    if (text_length < (buffer_size / 2) - 1)
    {
        mmi_ucs2cpy((S8*)buffer, (S8*)editor->buffer);
    }
    else
    {
        mmi_ucs2ncpy((S8*)buffer, (S8*)editor->buffer, (buffer_size / 2) - 1);
    }

    return text_length;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_get_text_len
 * DESCRIPTION
 *  Get the real text length (character count) of editor after editing.
 * PARAMETERS
 *  fseditor_gid        [IN]         FSEditor CUI Group ID
 * RETURNS
 *  S32    text length (character count) of editor buffer
 *****************************************************************************/
S32 cui_fseditor_get_text_len(mmi_id fseditor_gid)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* Editor instance is not exist any more */
    if (editor == NULL)
    {
        return 0;
    }

    return mmi_ucs2strlen((S8*)editor->buffer);
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_title_in_header
 * DESCRIPTION
 *  Set title in editor header area. For Landscape screen, there is no title in editor
 *  screen, if App want to display information on title, can set this flag.
 * PARAMETERS
 *  fseditor_gid        [IN]         FSEditor CUI Group ID
 *  title_in_header     [IN]         title in header or not
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_title_in_header(mmi_id fseditor_gid, MMI_BOOL title_in_header)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* Editor instance is not exist any more */
    if (editor == NULL)
    {
        return;
    }

    editor->is_title_in_header = title_in_header;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_cursor_first_pos
 * DESCRIPTION
 *  Set cursor position to the beginning of whole text.
 * PARAMETERS
 *  fseditor_gid        [IN]         FSEditor CUI Group ID
 *  is_first_pos        [IN]         is cursor at first pos
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_cursor_first_pos(mmi_id fseditor_gid, MMI_BOOL is_first_pos)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* Editor instance is not exist any more */
    if (editor == NULL)
    {
        return;
    }

    editor->set_cursor_first_pos = is_first_pos;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_auto_display_remaining_counter
 * DESCRIPTION
 *  set auto display editor counter (Only show the counter when reach certain length)
 * PARAMETERS
 *  fseditor_gid        [IN]         FSEditor CUI Group ID
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_auto_display_remaining_counter(mmi_id fseditor_gid)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* Editor instance is not exist any more */
    if (editor == NULL)
    {
        return;
    }

    editor->is_auto_display_counter = MMI_TRUE;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_is_disable_ncenter
 * DESCRIPTION
 *  set disable ncenter or not
 * PARAMETERS
 *  fseditor_gid        [IN]         FSEditor CUI Group ID
 *  value               [IN]         disable or not
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_is_disable_ncenter(mmi_id fseditor_gid, MMI_BOOL value)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* Editor instance is not exist any more */
    if (editor == NULL)
    {
        return;
    }

    editor->is_disable_ncenter = value;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_clear_key_delete_all_mode
 * DESCRIPTION
 *  Set clear key delete all mode. 
 *  By default the clear key long press will fast delete character by character
 * PARAMETERS
 *  fseditor_gid        [IN]         FSEditor CUI Group ID
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_clear_key_delete_all_mode(mmi_id fseditor_gid)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* Editor instance is not exist any more */
    if (editor == NULL)
    {
        return;
    }

    editor->is_delete_all = MMI_TRUE;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_softkey_text
 * DESCRIPTION
 *  Set Editor softykey text.
 *  NOTE: It call be call before/after editor CUI run.
 *        If CUI is running and current screen is editor screen, it will redraw softkey
 *        Otherwise, it only update softkey variables.
 * PARAMETERS
 *  fseditor_gid        [IN]        FSEditor CUI Group ID
 *  key_type            [IN]        softkey type:
                                    MMI_LEFT_SOFTKEY   -> LSK
                                    MMI_RIGHT_SOFTKEY  -> RSK
                                    MMI_CENTER_SOFTKEY -> CSK
 *  text                [IN]        softkey text
                                    Use STR_ID_CUI_FSEDITOR_DEFAULT set to default value
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_softkey_text(mmi_id fseditor_gid, WGUI_SOFTKEY_ENUM key_type, U16 text)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (editor == NULL)
    {
        return;
    }
    switch (key_type)
    {
        case MMI_LEFT_SOFTKEY:
            if (text != STR_ID_CUI_FSEDITOR_DEFAULT)
            {
                editor->lsk_label = text;
                editor->lsk_change_flag = MMI_TRUE;
            }
            else
            {
                editor->lsk_label = CUI_FSEDITOR_DEFAULT_LSK_TEXT;
                editor->lsk_change_flag = MMI_FALSE;
            }
            set_softkey_label((UI_string_type)GetString(editor->lsk_label), MMI_LEFT_SOFTKEY);
            /* Redraw lsk only when editor CUI is running and current screen is editor screen */
            if ((editor->state == CUI_FSEDITOR_STATE_RUN) &&
                (mmi_frm_scrn_get_active_id() == editor->editor_scr_id))
            {
                redraw_softkey(MMI_LEFT_SOFTKEY);
            }
            break;
        case MMI_RIGHT_SOFTKEY:
            if (text != STR_ID_CUI_FSEDITOR_DEFAULT)
            {
                editor->rsk_label = text;
            }
            else
            {
                editor->rsk_label = CUI_FSEDITOR_DEFAULT_RSK_TEXT;
            }
            wgui_inputbox_RSK_label_string = (UI_string_type)GetString(editor->rsk_label);

            /* Redraw rsk only when editor CUI is running and current screen is editor screen */
            if ((editor->state == CUI_FSEDITOR_STATE_RUN) &&
                (mmi_frm_scrn_get_active_id() == editor->editor_scr_id))
            {
                redraw_softkey(MMI_RIGHT_SOFTKEY);
            }
            break;
        case MMI_CENTER_SOFTKEY:
            if (text != STR_ID_CUI_FSEDITOR_DEFAULT)
            {
                editor->csk_label = text;
                editor->csk_change_flag = MMI_TRUE;
            }
            else
            {
                editor->csk_label = CUI_FSEDITOR_DEFAULT_CSK_TEXT;
                editor->csk_change_flag = MMI_FALSE;
            }

            if (editor->csk_label == 0)
            {
                set_softkey_label(NULL, MMI_CENTER_SOFTKEY);
            }
            else
            {
                set_softkey_label((UI_string_type)GetString(editor->csk_label), MMI_CENTER_SOFTKEY);
            }

            /* Redraw csk only when editor CUI is running and current screen is editor screen */
            if ((editor->state == CUI_FSEDITOR_STATE_RUN) &&
                (mmi_frm_scrn_get_active_id() == editor->editor_scr_id))
            {
                redraw_softkey(MMI_CENTER_SOFTKEY);
            }
            break;
    }

    register_softkey_handler(key_type);
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_softkey_icon
 * DESCRIPTION
 *  Set Editor softykey icon.
 *  NOTE: It call be call before/after editor CUI run.
 *        If CUI is running and current screen is editor screen, it will redraw softkey
 *        Otherwise, it only update softkey variables.
 * PARAMETERS
 *  fseditor_gid        [IN]        FSEditor CUI Group ID
 *  key_type            [IN]        softkey type
                                    MMI_LEFT_SOFTKEY   -> LSK
                                    MMI_RIGHT_SOFTKEY  -> RSK
                                    MMI_CENTER_SOFTKEY -> CSK
 *  text                [IN]        softkey icon
                                    Use IMG_ID_CUI_FSEDITOR_DEFAULT: set to default value 
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_softkey_icon(mmi_id fseditor_gid, WGUI_SOFTKEY_ENUM key_type, U16 icon)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (editor == NULL)
    {
        return;
    }
    switch (key_type)
    {
        case MMI_LEFT_SOFTKEY:
            if (icon != IMG_ID_CUI_FSEDITOR_DEFAULT)
            {
                editor->lsk_icon = icon;
                editor->lsk_change_flag = MMI_TRUE;
            }
            else
            {
                editor->lsk_icon = CUI_FSEDITOR_DEFAULT_LSK_ICON;
                editor->lsk_change_flag = MMI_FALSE;
            }
            set_softkey_icon((PU8)GetImage(editor->lsk_icon), MMI_LEFT_SOFTKEY);

            /* Redraw lsk only when editor CUI is running and current screen is editor screen */
            if ((editor->state == CUI_FSEDITOR_STATE_RUN) &&
                (mmi_frm_scrn_get_active_id() == editor->editor_scr_id))
            {
                redraw_softkey(MMI_LEFT_SOFTKEY);
            }
            break;
        case MMI_RIGHT_SOFTKEY:
            if (icon != IMG_ID_CUI_FSEDITOR_DEFAULT)
            {
                editor->rsk_icon = icon;
            }
            else
            {
                editor->rsk_icon = CUI_FSEDITOR_DEFAULT_RSK_ICON;
            }
            wgui_inputbox_RSK_label_icon = (PU8)GetImage(editor->rsk_icon);
            set_softkey_icon((PU8)GetImage(editor->lsk_icon), MMI_RIGHT_SOFTKEY);

            /* Redraw rsk only when editor CUI is running and current screen is editor screen */
            if ((editor->state == CUI_FSEDITOR_STATE_RUN) &&
                (mmi_frm_scrn_get_active_id() == editor->editor_scr_id))
            {
                redraw_softkey(MMI_RIGHT_SOFTKEY);
            }
            break;
        case MMI_CENTER_SOFTKEY:
            if (icon != IMG_ID_CUI_FSEDITOR_DEFAULT)
            {
                editor->csk_icon = icon;
                editor->csk_change_flag = MMI_TRUE;
            }
            else
            {
                editor->csk_icon = CUI_FSEDITOR_DEFAULT_CSK_ICON;
                editor->csk_change_flag = MMI_FALSE;
            }

            if (editor->csk_icon == 0)
            {
                set_softkey_icon(NULL, MMI_CENTER_SOFTKEY);
            }
            else
            {
                set_softkey_icon((PU8)GetImage(editor->csk_icon), MMI_CENTER_SOFTKEY);
            }

            /* Redraw csk only when editor CUI is running and current screen is editor screen */
            if ((editor->state == CUI_FSEDITOR_STATE_RUN) &&
                (mmi_frm_scrn_get_active_id() == editor->editor_scr_id))
            {
                redraw_softkey(MMI_CENTER_SOFTKEY);
            }
            break;
    }
    register_softkey_handler(key_type);
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_characters_filter
 * DESCRIPTION
 *  Set allowed/disallowed filter character list.
 *  App can specify which character can/can't be inserted to editor
 * PARAMETERS
 *  fseditor_gid        [IN]        FSEditor CUI Group ID
 *  is_allowed          [IN]        MMI_TRUE: can be inserted, MMI_FALSE: Can't be inserted
 *  characters_list     [IN]        Filter character list
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_characters_filter(mmi_id fseditor_gid, MMI_BOOL is_allowed, const UI_character_type *characters_list)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (editor == NULL)
    {
        return;
    }
    editor->set_characters_flag = is_allowed;
    editor->set_characters_list = characters_list;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_default_options_menu
 * DESCRIPTION
 *  Set default editor options menu item (Done/Cancel)
 *  App can use this API to change the Done/Cancel item to any other text
 *  NOTE: Editor will always send Submit event for Done, Abort event for Cancel menu item even if App
 *        has change its text.
 * PARAMETERS
 *  fseditor_gid                [IN]        FSEditor CUI Group ID
 *  options_done_label          [IN]        Editor Options done menu item label, use STR_ID_CUI_FSEDITOR_DEFAULT set to default value
 *  options_cancel_label        [IN]        Editor Options cancel menu item label, use STR_ID_CUI_FSEDITOR_DEFAULT set to default value
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_default_options_menu(mmi_id fseditor_gid, U16 options_done_label, U16 options_cancel_label)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (editor == NULL)
    {
        return;
    }
    if (options_done_label == STR_ID_CUI_FSEDITOR_DEFAULT)
    {
        editor->options_done_label = CUI_FSEDITOR_DEFAULT_OPTIONS_DONE;
    }
    else
    {
        editor->options_done_label = options_done_label;
    }

    if (options_cancel_label == STR_ID_CUI_FSEDITOR_DEFAULT)
    {
        editor->options_cancel_label = CUI_FSEDITOR_DEFAULT_OPTIONS_CANCEL;
    }
    else
    {
        editor->options_cancel_label = options_cancel_label;
    }
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_custom_options_menu
 * DESCRIPTION
 *  Set App custom options menu list. Custom options menu item will be add after Default menu item (Done/Cancel)
 *  Editor CUI will send EVT_ID_CUI_FSEDITOR_CUSTOM_MENU_SELECTED event to APP when custom options menu selected.
 * PARAMETERS
 *  fseditor_gid                [IN]        FSEditor CUI Group ID
 *  is_diable_defaut_menu       [IN]        If disable default menu item (Done/Cancel) or not
 *  menu_list                   [IN]        Custom options menu ID list
 *  count                       [IN]        Custom options menu count
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_custom_options_menu(mmi_id fseditor_gid, MMI_BOOL is_diable_defaut_menu, PU16 menu_list, U8 count)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (editor == NULL)
    {
        return;
    }
    editor->disable_def_opt_menu_flag = is_diable_defaut_menu;
    editor->options_cust_menu_list = menu_list;
    editor->options_cust_menu_count = count;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_disable_cancel_options_item
 * DESCRIPTION
 *  Disable Cancel option item or item
 * PARAMETERS
 *  fseditor_gid                [IN]        FSEditor CUI Group ID
 *  is_diable                   [IN]        If disable Cancel) or not
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_disable_cancel_options_item(mmi_id fseditor_gid, MMI_BOOL is_disable)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (editor == NULL)
    {
        return;
    }
    editor->disable_cancel_item = is_disable;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_property
 * DESCRIPTION
 *  Set fseditor CUI property. Set all fseditor CUI property at once. App need to create a fseditor property structure
 *  and set the specify value. Example:
 * <code>
    cui_fseditor_property_struct fseditor_property;
    mmi_id fseditor = cui_fseditor_create(my_id);

    CUI_FSEDITOR_STRUCT_INIT(&fseditor_property);
    fseditor_property.buffer = g_buffer;
    fseditor_property.buffer_size = MMI_APP_EDITOR_BUFFER_SIZE;
    fseditor_property.edit_length = MMI_APP_EDITOR_LENGTH;
    fseditor_property.input_type = IMM_INPUT_MODE_123;
    fseditor_property.title = STR_APP_TITLE;
    fseditor_property.title_icon = IMG_APP_ICON;
    cui_fseditor_set_property(fseditor, &fseditor_property);
  * </code>  
 * PARAMETERS
 *  fseditor_gid                [IN]        FSEditor CUI Group ID
 *  s                           [IN]        FSeditor CUI structure
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_property(mmi_id fseditor_gid, cui_fseditor_property_struct_p s)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (editor == NULL)
    {
        return;
    }
    editor->title = s->title;
    editor->title_icon = s->title_icon;
    editor->title_string = s->title_string;
    if (s->buffer_size <= CUI_FSEDITOR_MAX_BUFFER_SIZE)
    {
        if (s->buffer)
        {
            mmi_ucs2cpy((S8*)editor->text_buffer, (S8*)s->buffer);
            editor->buffer = editor->text_buffer;
        }
    }
    else
    {
        if (s->buffer)
        {
            editor->buffer = s->buffer;
        }
        else
        {
            /* App must use global/static memory for edit when size large than CUI_FSEDITOR_MAX_BUFFER_SIZE */
            MMI_ASSERT(0);
        }
    }
    editor->buffer_size = s->buffer_size;
    editor->edit_length = s->edit_length;
    editor->parent_data = s->parent_data;
    if (s->input_type)
    {
        editor->input_type = s->input_type;
    }
    editor->required_input_mode_set = s->required_input_mode_set;
    editor->input_ext_type = s->input_ext_type;
    if (s->lsk_label)
    {
        editor->lsk_label = s->lsk_label;
    }
    if (s->lsk_icon)
    {
        editor->lsk_icon = s->lsk_icon;
    }
    if (s->rsk_label)
    {
        editor->rsk_label = s->rsk_label;
    }
    if (s->rsk_icon)
    {
        editor->rsk_icon = s->rsk_icon;
    }
    if (s->csk_label)
    {
        editor->csk_label = s->csk_label;
    }
    if (s->csk_icon)
    {
        editor->csk_icon = s->csk_icon;
    }
    if (s->options_done_label)
    {
        editor->options_done_label = s->options_done_label;
    }
    if (s->options_cancel_label)
    {
        editor->options_cancel_label = s->options_cancel_label;
    }
    editor->options_cust_menu_list = s->options_cust_menu_list;
    editor->options_cust_menu_count = s->options_cust_menu_count;
    editor->set_characters_list = s->set_characters_list;
    editor->set_characters_flag = s->set_characters_flag;
    editor->disable_def_opt_menu_flag = s->disable_def_opt_menu_flag;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_set_parent_data
 * DESCRIPTION
 *  Set parent data. App can set parent data and retrieve it by cui_fseditor_get_parent_data
 * PARAMETERS
 *  fseditor_gid        [IN]        FSEditor CUI Group ID
 *  parent_data         [IN]        Parent data
 * RETURNS
 *  void
 *****************************************************************************/
void cui_fseditor_set_parent_data(mmi_id fseditor_gid, U32 parent_data)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_ASSERT(editor != NULL);
    editor->parent_data = parent_data;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_get_parent_data
 * DESCRIPTION
 *  Get parent data. App can set parent data by cui_fseditor_set_parent_data
 * PARAMETERS
 *  fseditor_gid        [IN]        FSEditor CUI Group ID
 * RETURNS
 *  U32
 *****************************************************************************/
U32 cui_fseditor_get_parent_data(mmi_id fseditor_gid)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_ASSERT(editor != NULL);
    return editor->parent_data;
}


/*****************************************************************************
 * FUNCTION
 *  cui_fseditor_append_text
 * DESCRIPTION
 *  Append text to editor CUI buffer
 * PARAMETERS
 *  fseditor_gid        [IN]        FSEditor CUI Group ID
 *  text                [IN]        text
 * RETURNS
 *  U32
 *****************************************************************************/
void cui_fseditor_append_text(mmi_id fseditor_gid, WCHAR *text)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_fseditor_struct *editor = (cui_fseditor_struct*) mmi_frm_group_get_user_data(fseditor_gid);
    PU8 history_buffer = NULL;
    S32 len = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_ASSERT(editor != NULL);
    history_buffer = mmi_frm_scrn_get_gui_buf(fseditor_gid, SCR_FSEDITOR);

    if (history_buffer)
    {
        AppendCategory5String(
            editor->input_type,
            (PU8)editor->buffer,
            editor->buffer_size,
            (PU8)text,
            history_buffer);
    }
    else
    {
        /* Current screen is editor screen */
        len = gui_strlen(text);
        wgui_inputs_ml_insert_string((UI_string_type)text, len, MMI_TRUE);
    }
}

#if 0
/* under construction !*/
#ifdef CUI_FSSEDITOR_APP_TEST_SAMPLE
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif /* CUI_FSSEDITOR_APP_TEST_SAMPLE */
#endif