wgui_categories_IMPS.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:196k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  *  wgui_categories_IMPS.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *  MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *  IMPS related categories. 
  48.  *
  49.  *  [Category420]       About Me Screen
  50.  *  [Category425]       Contact List Screen (also used by PoC)
  51.  *  [Category435]       Chat Screen with Popup Editor
  52.  *
  53.  *
  54.  *  TTY related categories.
  55.  *  [Category430]       Chat Log Screen 
  56.  *
  57.  * Author:
  58.  * -------
  59.  * -------
  60.  *
  61.  *============================================================================
  62.  *             HISTORY
  63.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  64.  *------------------------------------------------------------------------------
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  *
  123.  * removed!
  124.  * removed!
  125.  * removed!
  126.  *
  127.  * removed!
  128.  * removed!
  129.  * removed!
  130.  *
  131.  * removed!
  132.  * removed!
  133.  * removed!
  134.  *
  135.  * removed!
  136.  * removed!
  137.  * removed!
  138.  *
  139.  * removed!
  140.  * removed!
  141.  * removed!
  142.  *
  143.  * removed!
  144.  * removed!
  145.  * removed!
  146.  *
  147.  * removed!
  148.  * removed!
  149.  * removed!
  150.  *
  151.  * removed!
  152.  * removed!
  153.  * removed!
  154.  *
  155.  * removed!
  156.  * removed!
  157.  * removed!
  158.  *
  159.  * removed!
  160.  * removed!
  161.  * removed!
  162.  *
  163.  *------------------------------------------------------------------------------
  164.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  165.  *============================================================================
  166.  ****************************************************************************/
  167. #include "MMI_features.h"
  168. /* framework related include */
  169. #include "EventsGprot.h"
  170. #include "GlobalDefs.h"
  171. #include "FrameworkStruct.h"
  172. #include "EventsDef.h"
  173. #include "Unicodexdcl.h"
  174. #include "DebugInitDef.h"
  175. /* gui related include */
  176. #include "gui_themes.h"
  177. #include "wgui.h"
  178. #include "wgui_softkeys.h"
  179. #include "wgui_tab_bars.h"
  180. #include "wgui_categories.h"
  181. #include "wgui_categories_defs.h"
  182. #include "wgui_categories_inputs.h"
  183. #include "wgui_categories_IMPS.h"
  184. #include "wgui_categories_popup.h"
  185. #include "wgui_inputs.h"
  186. #ifdef __MMI_TOUCH_SCREEN__
  187. #include "wgui_touch_screen.h"
  188. #include "EditorPen.h"
  189. #include "wgui_virtual_keyboard.h"
  190. #endif /* __MMI_TOUCH_SCREEN__ */ 
  191. #include "gdi_include.h"
  192. #include "gd_primitive.h"
  193. #include "kal_non_specific_general_types.h"     /* include this for kal data type */
  194. #include "lcd_sw_rnd.h"
  195. #include "gui_setting.h"
  196. #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) || defined(__MMI_SMART_MESSAGE_MT__)
  197. #include "MyPicture.h"
  198. #endif 
  199. #ifdef __MMI_T9__
  200. #include "T9Main.h"     /* T9SynT9WithInputBox() */
  201. extern void InuptMethodEnterCategory5(void);
  202. #elif defined __MMI_ZI__
  203. extern void ZiInuptMethodEnterCategory5(void);
  204. //KP Jerry add on 2007-3-8 start
  205. #elif defined __MMI_CSTAR__
  206. extern void CstarInputMethodEnterCategory5(void);
  207. //KP Jerry add on 2007-3-8 end
  208. #elif defined __MMI_KA__
  209. extern void KonkaInuptMethodEnterCategory5(void);
  210. #elif defined __MMI_ITAP__
  211. /* under construction !*/
  212. #endif 
  213. extern S32 gui_asyncdynamic_list_error;
  214. extern BOOL r2lMMIFlag;
  215. /***************************************************************************** 
  216. * Customizable Definitions
  217. *****************************************************************************/
  218. /* 
  219.  * Category 420 
  220.  */
  221. #if defined(__MMI_MAINLCD_128X160__)
  222. /* Whether to display mood/status description text */
  223. #undef CAT420_DISP_INFO_TEXT
  224. #define CAT420_TOP_MARGIN                    2
  225. /* Between information and description text */
  226. #define CAT420_BOTTOM_MARGIN                 4
  227. #define CAT420_LEFT_MARGIN                   5
  228. #define CAT420_RIGHT_MARGIN                  3
  229. #define CAT420_IMAGE_H_SPACING               (CAT420_RIGHT_MARGIN)
  230. #define CAT420_LINE_EXTRA_PIXEL              10
  231. #define CAT420_NAME_LINE_V_SPACING           3
  232. #define CAT420_LINE_IMAGE_V_SPACING          6
  233. #define CAT420_CAPTION_IMAGE_H_SPACING       6
  234. #define CAT420_MOOD_STATUS_V_SPACING         3
  235. /* Default image width */
  236. #define CAT420_IMAGE_AREA_WIDTH              (60)
  237. /* Minimum image width */
  238. #define CAT420_IMAGE_AREA_MIN_WIDTH          (40)
  239. #define CAT420_EDITOR_LEFT_BORDER_PADDING    (CAT420_LEFT_MARGIN)
  240. #define CAT420_EDITOR_RIGHT_BORDER_PADDING   (CAT420_RIGHT_MARGIN)
  241. #define CAT420_EDITOR_BOTTOM_PADDING         (5)
  242. #elif defined(__MMI_MAINLCD_176X220__)
  243. /* Whether to display mood/status description text */
  244. #define CAT420_DISP_INFO_TEXT
  245. #define CAT420_TOP_MARGIN                    2
  246. /* Between information and description text */
  247. #define CAT420_BOTTOM_MARGIN                 7
  248. #define CAT420_LEFT_MARGIN                   7
  249. #define CAT420_RIGHT_MARGIN                  5
  250. #define CAT420_IMAGE_H_SPACING               (CAT420_RIGHT_MARGIN)
  251. #define CAT420_LINE_EXTRA_PIXEL              10
  252. #define CAT420_NAME_LINE_V_SPACING           3
  253. #define CAT420_LINE_IMAGE_V_SPACING          6
  254. #define CAT420_CAPTION_IMAGE_H_SPACING       6
  255. #define CAT420_MOOD_STATUS_V_SPACING         3
  256. /* Default image width */
  257. #define CAT420_IMAGE_AREA_WIDTH              (65)
  258. /* Minimum image width */
  259. #define CAT420_IMAGE_AREA_MIN_WIDTH          (45)
  260. #define CAT420_EDITOR_LEFT_BORDER_PADDING    (CAT420_LEFT_MARGIN)
  261. #define CAT420_EDITOR_RIGHT_BORDER_PADDING   (CAT420_RIGHT_MARGIN)
  262. #define CAT420_EDITOR_BOTTOM_PADDING         (7)
  263. #else 
  264. /* For 240x320. 128x128 is also compiled but not linked */
  265. /* Whether to display mood/status description text */
  266. #define CAT420_DISP_INFO_TEXT
  267. #define CAT420_TOP_MARGIN                    2
  268. /* Between information and description text */
  269. #define CAT420_BOTTOM_MARGIN                 7
  270. #define CAT420_LEFT_MARGIN                   6
  271. #define CAT420_RIGHT_MARGIN                  6
  272. #define CAT420_IMAGE_H_SPACING               (CAT420_RIGHT_MARGIN)
  273. #define CAT420_LINE_EXTRA_PIXEL              15
  274. #define CAT420_NAME_LINE_V_SPACING           4
  275. #define CAT420_LINE_IMAGE_V_SPACING          8
  276. #define CAT420_CAPTION_IMAGE_H_SPACING       6
  277. #define CAT420_MOOD_STATUS_V_SPACING         4
  278. /* Default image width */
  279. #define CAT420_IMAGE_AREA_WIDTH              (100)
  280. /* Minimum image width */
  281. #define CAT420_IMAGE_AREA_MIN_WIDTH          (60)
  282. #define CAT420_EDITOR_LEFT_BORDER_PADDING    (CAT420_LEFT_MARGIN)
  283. #define CAT420_EDITOR_RIGHT_BORDER_PADDING   (CAT420_RIGHT_MARGIN)
  284. #define CAT420_EDITOR_BOTTOM_PADDING         (7)
  285. #endif 
  286. #define CAT420_TEXT_COLOR_R                  64
  287. #define CAT420_TEXT_COLOR_G                  64
  288. #define CAT420_TEXT_COLOR_B                  64
  289. #define CAT420_LINE_COLOR_R                  144
  290. #define CAT420_LINE_COLOR_G                  104
  291. #define CAT420_LINE_COLOR_B                  48
  292. /* 
  293.  * Category 425
  294.  */
  295. #if defined(__MMI_MAINLCD_128X160__)
  296. #define CAT425_DEFAULT_ICON_WIDTH            26
  297. #define CAT425_DEFAULT_ICON_HEIGHT           26
  298. #define CAT425_DEFAULT_ICON2_WIDTH           10
  299. #define CAT425_DEFAULT_ICON2_HEIGHT          10
  300. #define CAT425_ICON_X                        2
  301. #define CAT425_ICON_Y                        4
  302. #define CAT425_ICON_TEXT_GAP                 4
  303. #define CAT425_TEXT_SCROLLBAR_GAP            2
  304. #define CAT425_TEXT1_Y                       0
  305. #define CAT425_TEXT2_Y                       16
  306. #define CAT425_TEXT_HEIGHT                   16
  307. #define CAT425_MENUITEM_HEIGHT               33
  308. #define CAT425_MENUITEM_HEIGHT_NO_TAB        39
  309. #define CAT425_TEXT2_BRACKET_GAP             1
  310. #elif defined(__MMI_MAINLCD_176X220__)
  311. #define CAT425_DEFAULT_ICON_WIDTH            32
  312. #define CAT425_DEFAULT_ICON_HEIGHT           32
  313. #define CAT425_DEFAULT_ICON2_WIDTH           10
  314. #define CAT425_DEFAULT_ICON2_HEIGHT          10
  315. #define CAT425_ICON_X                        2
  316. #define CAT425_ICON_Y                        1
  317. #define CAT425_ICON_TEXT_GAP                 4
  318. #define CAT425_TEXT_SCROLLBAR_GAP            2
  319. #define CAT425_TEXT1_Y                       0
  320. #define CAT425_TEXT2_Y                       17
  321. #define CAT425_TEXT_HEIGHT                   17
  322. #define CAT425_MENUITEM_HEIGHT               35
  323. #define CAT425_MENUITEM_HEIGHT_NO_TAB        39
  324. #define CAT425_TEXT2_BRACKET_GAP             1
  325. #else 
  326. /* For 240x320. 128x128 is also compiled but not linked */
  327. #define CAT425_DEFAULT_ICON_WIDTH            40
  328. #define CAT425_DEFAULT_ICON_HEIGHT           42
  329. #define CAT425_DEFAULT_ICON2_WIDTH           10
  330. #define CAT425_DEFAULT_ICON2_HEIGHT          10
  331. #define CAT425_ICON_X                        2
  332. #define CAT425_ICON_Y                        5
  333. #define CAT425_ICON_TEXT_GAP                 6
  334. #define CAT425_TEXT_SCROLLBAR_GAP            3
  335. #define CAT425_TEXT1_Y                       0
  336. #define CAT425_TEXT2_Y                       27
  337. #define CAT425_TEXT_HEIGHT                   22
  338. #define CAT425_MENUITEM_HEIGHT               55
  339. #define CAT425_MENUITEM_HEIGHT_NO_TAB        60
  340. #define CAT425_TEXT2_BRACKET_GAP             2
  341. #endif 
  342. #if defined(__MMI_MAINLCD_240X320__)
  343. #define CAT425_ICON_BORDER_COLOR_R           187
  344. #define CAT425_ICON_BORDER_COLOR_G           227
  345. #define CAT425_ICON_BORDER_COLOR_B           254
  346. #define CAT425_ICON_HIGHLIGHT_BORDER_COLOR_R          128
  347. #define CAT425_ICON_HIGHLIGHT_BORDER_COLOR_G          0
  348. #define CAT425_ICON_HIGHLIGHT_BORDER_COLOR_B          0
  349. // #define CAT425_TEXT1_COLOR_R                                         230
  350. // #define CAT425_TEXT1_COLOR_G                                         230
  351. // #define CAT425_TEXT1_COLOR_B                                         230
  352. // #define CAT425_TEXT2_COLOR_R                                         148
  353. // #define CAT425_TEXT2_COLOR_G                                         188
  354. // #define CAT425_TEXT2_COLOR_B                                         220
  355. // #define CAT425_TEXT1_HIGHLIGHT_COLOR_R                               255
  356. // #define CAT425_TEXT1_HIGHLIGHT_COLOR_G                               255
  357. // #define CAT425_TEXT1_HIGHLIGHT_COLOR_B                               255
  358. // #define CAT425_TEXT2_HIGHLIGHT_COLOR_R                               255
  359. // #define CAT425_TEXT2_HIGHLIGHT_COLOR_G                               255
  360. // #define CAT425_TEXT2_HIGHLIGHT_COLOR_B                               106
  361. #define CAT425_TEXT2_BRACKET_COLOR_R         187
  362. #define CAT425_TEXT2_BRACKET_COLOR_G         227
  363. #define CAT425_TEXT2_BRACKET_COLOR_B         254
  364. #define CAT425_LINE_COLOR_R                  192
  365. #define CAT425_LINE_COLOR_G                  192
  366. #define CAT425_LINE_COLOR_B                  192
  367. #else /* defined(__MMI_MAINLCD_240X320__) */ 
  368. #define CAT425_ICON_BORDER_COLOR_R           0
  369. #define CAT425_ICON_BORDER_COLOR_G           56
  370. #define CAT425_ICON_BORDER_COLOR_B           136
  371. #define CAT425_ICON_HIGHLIGHT_BORDER_COLOR_R          128
  372. #define CAT425_ICON_HIGHLIGHT_BORDER_COLOR_G          0
  373. #define CAT425_ICON_HIGHLIGHT_BORDER_COLOR_B          0
  374. #define CAT425_TEXT1_COLOR_R                 72
  375. #define CAT425_TEXT1_COLOR_G                 72
  376. #define CAT425_TEXT1_COLOR_B                 72
  377. #define CAT425_TEXT2_COLOR_R                 48
  378. #define CAT425_TEXT2_COLOR_G                 88
  379. #define CAT425_TEXT2_COLOR_B                 120
  380. #define CAT425_TEXT1_HIGHLIGHT_COLOR_R          255
  381. #define CAT425_TEXT1_HIGHLIGHT_COLOR_G          255
  382. #define CAT425_TEXT1_HIGHLIGHT_COLOR_B          255
  383. #define CAT425_TEXT2_HIGHLIGHT_COLOR_R          255
  384. #define CAT425_TEXT2_HIGHLIGHT_COLOR_G          255
  385. #define CAT425_TEXT2_HIGHLIGHT_COLOR_B          106
  386. #define CAT425_TEXT2_BRACKET_COLOR_R         56
  387. #define CAT425_TEXT2_BRACKET_COLOR_G         112
  388. #define CAT425_TEXT2_BRACKET_COLOR_B         200
  389. #define CAT425_LINE_COLOR_R                  142
  390. #define CAT425_LINE_COLOR_G                  142
  391. #define CAT425_LINE_COLOR_B                  142
  392. #endif /* defined(__MMI_MAINLCD_240X320__) */ 
  393. /* 
  394.  * Category 430
  395.  */
  396. #define CAT430_NAME1_COLOR_R                 107
  397. #define CAT430_NAME1_COLOR_G                 93
  398. #define CAT430_NAME1_COLOR_B                 247
  399. #define CAT430_NAME2_COLOR_R                 231
  400. #define CAT430_NAME2_COLOR_G                 77
  401. #define CAT430_NAME2_COLOR_B                 198
  402. #define CAT430_NAME_FONT_ENUM                MEDIUM_FONT
  403. #define CAT430_NAME_FONT                     (&MMI_medium_font)
  404. #define CAT430_SENT_COLOR_MARKER             GUI_INPUT_COLOR_BLACK
  405. /* Marker length in sending box, we use two color code */
  406. #define CAT430_MARKER_COUNT                  2
  407. #ifdef __MMI_MAINLCD_240X320__
  408. #define CAT430_VERTICAL_GAP                  4
  409. #define CAT430_HORIZONTAL_GAP                3
  410. #define CAT430_SENDING_BOX_V_GAP             2
  411. #define CAT430_SENDING_BOX_H_GAP             0
  412. #else /* __MMI_MAINLCD_240X320__ */ 
  413. #define CAT430_VERTICAL_GAP                  2
  414. #define CAT430_HORIZONTAL_GAP                2
  415. #define CAT430_SENDING_BOX_V_GAP             2
  416. #define CAT430_SENDING_BOX_H_GAP             0
  417. #endif /* __MMI_MAINLCD_240X320__ */ 
  418. #if !defined(__MMI_MAINLCD_128X128__)
  419. /* Show name outside logbox */
  420. #undef CAT430_NAME_IN_LOG
  421. #else /* !defined(__MMI_MAINLCD_128X128__) */ 
  422. /* Show name inside logbox */
  423. #define CAT430_NAME_IN_LOG
  424. #endif /* !defined(__MMI_MAINLCD_128X128__) */ 
  425. /* 
  426.  * Category 435
  427.  */
  428. #define CAT435_POPUP_X                       (MMI_content_x)
  429. #define CAT435_POPUP_WIDTH                   (MMI_CONTENT_WIDTH_WITH_H_TAB)
  430. #ifdef __MMI_MAINLCD_128X160__
  431. #define CAT435_POPUP_OVERLAP_TAB_BAR         1
  432. #define CAT435_POPUP_Y                       (MMI_CONTENT_Y_WITH_H_TAB - 6)
  433. #define CAT435_POPUP_HEIGHT                  (MMI_CONTENT_HEIGHT_WITH_H_TAB + 6)
  434. #undef CAT435_SHOW_LOG_BOX_WITH_POPUP
  435. #undef CAT435_POPUP_WITH_BORDER_TITLE
  436. /* Title height in popup */
  437. #define CAT435_POPUP_TITLE_HEIGHT            18
  438. /* Bottom gap between editor and multitap */
  439. #define CAT435_POPUP_BOTTOM_GAP              0  /* HACK. 0 for ZI input method */
  440. /* Horizontal gap */
  441. #define CAT435_POPUP_H_GAP                   0  /* HACK. 0 for ZI input method */
  442. #elif defined(__MMI_MAINLCD_176X220__)
  443. #undef CAT435_POPUP_OVERLAP_TAB_BAR
  444. #ifdef __MMI_TOUCH_SCREEN__
  445. /* Virtual keyboard takes more space */
  446. #define CAT435_POPUP_Y                       (MMI_CONTENT_Y_WITH_H_TAB - 4)
  447. #define CAT435_POPUP_HEIGHT                  (MMI_CONTENT_HEIGHT_WITH_H_TAB + 4)
  448. #undef CAT435_SHOW_LOG_BOX_WITH_POPUP
  449. #else /* __MMI_TOUCH_SCREEN__ */ 
  450. #define CAT435_POPUP_Y                       (MMI_CONTENT_Y_WITH_H_TAB + (MMI_CONTENT_HEIGHT_WITH_H_TAB /5))
  451. #define CAT435_POPUP_HEIGHT                  (MMI_CONTENT_HEIGHT_WITH_H_TAB - (MMI_CONTENT_HEIGHT_WITH_H_TAB /5))
  452. #define CAT435_SHOW_LOG_BOX_WITH_POPUP
  453. #endif /* __MMI_TOUCH_SCREEN__ */ 
  454. #define CAT435_POPUP_WITH_BORDER_TITLE
  455. /* Title height in popup */
  456. #define CAT435_POPUP_TITLE_HEIGHT            19
  457. /* Bottom gap between editor and multitap */
  458. #define CAT435_POPUP_BOTTOM_GAP              0  /* HACK. 0 for ZI input method */
  459. /* Horizontal gap */
  460. #define CAT435_POPUP_H_GAP                   0  /* HACK. 0 for ZI input method */
  461. #else 
  462. /* For 240x320. 128x128 is also compiled but not linked */
  463. #ifdef __MMI_TOUCH_SCREEN__
  464. /* Virtual keyboard takes more space */
  465. #define CAT435_POPUP_Y                       (MMI_CONTENT_Y_WITH_H_TAB)
  466. #define CAT435_POPUP_HEIGHT                  (MMI_CONTENT_HEIGHT_WITH_H_TAB)
  467. #undef CAT435_SHOW_LOG_BOX_WITH_POPUP
  468. #else /* __MMI_TOUCH_SCREEN__ */ 
  469. #define CAT435_POPUP_Y                       (MMI_CONTENT_Y_WITH_H_TAB + (MMI_CONTENT_HEIGHT_WITH_H_TAB /5))
  470. #define CAT435_POPUP_HEIGHT                  (MMI_CONTENT_HEIGHT_WITH_H_TAB - (MMI_CONTENT_HEIGHT_WITH_H_TAB /5))
  471. #define CAT435_SHOW_LOG_BOX_WITH_POPUP
  472. #endif /* __MMI_TOUCH_SCREEN__ */ 
  473. #define CAT435_POPUP_WITH_BORDER_TITLE
  474. /* Title height in popup */
  475. #define CAT435_POPUP_TITLE_HEIGHT            30
  476. /* Bottom gap between editor and multitap */
  477. #define CAT435_POPUP_BOTTOM_GAP              0  /* HACK. 0 for ZI input method */
  478. /* Horizontal gap */
  479. #define CAT435_POPUP_H_GAP                   0  /* HACK. 0 for ZI input method */
  480. #endif 
  481. #define CAT435_BACKGROUND_WHITE_VALUE        (80)
  482. /***************************************************************************** 
  483. * Typedef 
  484. *****************************************************************************/
  485. /* 
  486.  * Category 420 
  487.  */
  488. typedef struct
  489. {
  490.     /* Data */
  491.     UI_string_type name;
  492.     U16 mood_caption;
  493.     UI_string_type mood_string;
  494.     PU8 mood_icon;
  495.     U16 status_caption;
  496.     UI_string_type status_string;
  497.     PU8 status_icon;
  498.     S16 image_ori_width, image_ori_height;
  499.     /* Image cache */
  500.     U32 display_image:1;
  501.     U32 image_is_cached:1;
  502.     gdi_handle cache_layer;
  503.     /* Layout */
  504.     S16 content_width;
  505.     S16 editor_header_height;
  506.     S16 name_x, name_y, name_width;
  507.     S16 line_x1, line_x2, line_y;
  508.     S16 mood_caption_x, mood_caption_y;
  509.     S16 mood_image_x, mood_image_y;
  510. #ifdef CAT420_DISP_INFO_TEXT
  511.     S16 mood_text_x, mood_text_y;
  512. #endif 
  513.     S16 status_caption_x, status_caption_y;
  514.     S16 status_image_x, status_image_y;
  515. #ifdef CAT420_DISP_INFO_TEXT
  516.     S16 status_text_x, status_text_y;
  517. #endif 
  518.     S16 image_area_x, image_area_y;
  519.     S16 image_area_width, image_area_height;
  520.     S16 image_x_offset, image_y_offset;
  521.     S16 image_resized_width, image_resized_height;  /* 0 if no resize */
  522. } gui_cat420_context_struct;
  523. /* 
  524.  * Category 425
  525.  */
  526. typedef struct
  527. {
  528.     U32 backup_menu_flags;
  529.     UI_filled_area *backup_menu_filler;
  530.     S16 icon_border_x1, icon_border_y1, icon_border_x2, icon_border_y2;
  531.     S16 bracket_x, bracket_y;
  532.     S16 num_tab;
  533.     S32 content_x, content_y, content_width, content_height;
  534.     /* For RefreshCategory425Screen */
  535.     GetAsyncItemFuncPtr get_item_func;
  536.     GetAsyncHintFuncPtr get_hint_func;
  537. } gui_cat425_context_struct;
  538. /* 
  539.  * Category 430
  540.  */
  541. typedef struct
  542. {
  543.     /* Another input box */
  544.     multi_line_input_box log_box1;
  545.     U8 *allocated_color_buffer;         /* Add color marker */
  546.     /* Data */
  547.     U8 *name1, *name2;
  548.     U8 *log_buffer1;
  549.     U8 *log_buffer2;
  550.     U8 *sending_buffer;
  551.     S16 log_buffer_size1;
  552.     S16 log_buffer_size2;
  553.     S16 max_sending_buffer_size;
  554.     S16 sent_count;
  555.     S16 allocated_color_buffer_size;
  556.     MMI_BOOL show_sending_buffer;
  557. #ifdef __MMI_TOUCH_SCREEN__
  558.     U8 pen_object;                      /* 0: none, 1: log_box1, 2: log_box2 */
  559. #endif 
  560.     /* Layout */
  561. #ifndef CAT430_NAME_IN_LOG
  562.     S16 name1_x, name1_y;
  563.     S16 name2_x, name2_y;
  564. #else /* CAT430_NAME_IN_LOG */ 
  565.     S16 log_box_header_height;
  566. #endif /* CAT430_NAME_IN_LOG */ 
  567.     S16 log_box1_x, log_box1_y;
  568.     S16 log_box1_width, log_box1_height;
  569.     S16 log_box2_x, log_box2_y;
  570.     S16 log_box2_width, log_box2_height;
  571.     S16 log_box2_footer_height;
  572.     S16 sending_box_x, sending_box_y;   /* relative coordinates */
  573.     S16 sending_box_width;
  574. } gui_cat430_context_struct;
  575. typedef struct
  576. {
  577.     S32 dummy;
  578. } gui_cat430_history_header_struct;
  579. /* 
  580.  * Category 435
  581.  */
  582. typedef struct
  583. {
  584.     /* Backup original MMI context */
  585.     UI_filled_area *backup_multitap_filler;
  586.     color backup_information_bar_color;
  587.     S32 backup_MMI_editor_width, backup_MMI_editor_height;
  588.     /* Log editor box */
  589.     multi_line_input_box log_box;
  590.     UI_filled_area log_box_scrollbar_sbutton_filler;
  591.     /* Category parameters */
  592.     U16 right_softkey;
  593.     U16 right_softkey_icon;
  594.     U16 left_softkey;
  595.     U16 left_softkey_icon;
  596.     U16 editor_right_softkey;
  597.     U16 editor_right_softkey_icon;
  598.     U16 editor_left_softkey;
  599.     U16 editor_left_softkey_icon;
  600.     UI_string_type popup_title;
  601.     /* Softkey handlers */
  602.     void (*editor_LSK_func) (void);
  603.     void (*editor_RSK_func) (void);
  604.     void (*LSK_func) (void);
  605.     void (*RSK_func) (void);
  606.     /* Whether the popup editor is displayed */
  607.     BOOL show_popup;
  608.     /* Data used to setup the popup editor */
  609.     BOOL editor_created;    /* For debug only */
  610.     S16 input_type;
  611.     U8 *buffer;
  612.     S8 icon_height;
  613.     S32 buffer_size;
  614.     multi_line_input_box_icon_hdlr icon_callback;
  615. } gui_cat435_context_struct;
  616. typedef struct
  617. {
  618.     U8 show_popup;
  619.     U8 dummy[3];    /* Align to four bytes */
  620. } gui_cat435_history_header_struct;
  621. /***************************************************************************** 
  622. * Local Variable
  623. *****************************************************************************/
  624. /* 
  625.  * Category 420 
  626.  */
  627. static gui_cat420_context_struct *g_mmi_gui_cat420_context_p;
  628. #define CAT420_CTX         (g_mmi_gui_cat420_context_p)
  629. static const U8 g_mmi_gui_cat420_line_style[] = {1, 1, 1, 0, 1, 0};
  630. static UI_filled_area g_mmi_gui_cat420_text_filler = {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_BORDER,
  631.     NULL,
  632.     NULL,
  633.     {200, 248, 232, 100},
  634.     {0, 0, 0, 0},
  635.     {80, 136, 80, 0},
  636.     {0, 0, 0, 0},
  637.     0
  638. };
  639. /* 
  640.  * Category 425
  641.  */
  642. static gui_cat425_context_struct *g_mmi_gui_cat425_context_p;
  643. #define CAT425_CTX         (g_mmi_gui_cat425_context_p)
  644. #if 0
  645. /* under construction !*/
  646. /* under construction !*/
  647. /* under construction !*/
  648. /* under construction !*/
  649. /* under construction !*/
  650. /* under construction !*/
  651. /* under construction !*/
  652. /* under construction !*/
  653. /* under construction !*/
  654. /* under construction !*/
  655. #endif /* 0 */ 
  656. static const U8 g_mmi_gui_cat425_line_bitvalues[] = {1, 1, 0};
  657. /* 
  658.  * Category 430
  659.  */
  660. static gui_cat430_context_struct *g_mmi_gui_cat430_context_p;
  661. #define CAT430_CTX         (g_mmi_gui_cat430_context_p)
  662. static const UI_filled_area g_mmi_gui_cat430_logbox_filler = 
  663. {
  664.     UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_BORDER,
  665.     NULL,
  666.     NULL,
  667.     {255, 255, 255, 100},
  668.     {0, 0, 0, 0},
  669.     {33, 28, 140, 100},
  670.     {0, 0, 0, 0},
  671.     0
  672. };
  673. static const UI_filled_area g_mmi_gui_cat430_sending_filler = 
  674. {
  675.     UI_FILLED_AREA_TYPE_COLOR,
  676.     NULL,
  677.     NULL,
  678.     {225, 220, 225, 100},
  679.     {0, 0, 0, 0},
  680.     {0, 0, 0, 100},
  681.     {0, 0, 0, 0},
  682.     0
  683. };
  684. /* 
  685.  * Category 435
  686.  */
  687. static gui_cat435_context_struct *g_mmi_gui_cat435_context_p;
  688. #define CAT435_CTX         (g_mmi_gui_cat435_context_p)
  689. static const UI_filled_area g_mmi_gui_cat435_editor_filler = 
  690. {
  691. #ifdef __MMI_TOUCH_SCREEN__
  692.     UI_FILLED_AREA_TYPE_COLOR,  /* No border due to virtual keyboard */
  693. #else 
  694.     UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_BORDER,
  695. #endif 
  696.     NULL,
  697.     NULL,
  698.     {255, 254, 209, 100},
  699.     {0, 0, 0, 0},
  700.     {184, 184, 184, 100},
  701.     {0, 0, 0, 0},
  702.     0
  703. };
  704. static const UI_filled_area g_mmi_gui_cat435_multitap_filler = {UI_FILLED_AREA_TYPE_COLOR,
  705.     NULL,
  706.     NULL,
  707.     {216, 208, 200, 100},
  708.     {0, 0, 0, 0},
  709.     {0, 0, 0, 0},
  710.     {0, 0, 0, 0},
  711.     0
  712. };
  713. static const color g_mmi_gui_cat435_popup_color = {216, 208, 200, 100};
  714. #if defined (__MMI_WALLPAPER_ON_BOTTOM__)
  715. static MMI_ID_TYPE editor_scr_bg_ID;
  716. static S8 *editor_scr_bg_filename;
  717. static S32 editor_scr_bg_x, editor_scr_bg_y;
  718. static U8 editor_scr_bg_opacity;
  719. #endif /* defined (__MMI_WALLPAPER_ON_BOTTOM__) */ 
  720. /***************************************************************************** 
  721. * Local Function
  722. *****************************************************************************/
  723. /* 
  724.  * Category 420 
  725.  */
  726. /*****************************************************************************
  727.  * FUNCTION
  728.  *  category420_compute_layout
  729.  * DESCRIPTION
  730.  *  
  731.  * PARAMETERS
  732.  *  void
  733.  * RETURNS
  734.  *  void
  735.  *****************************************************************************/
  736. static void category420_compute_layout(void)
  737. {
  738.     /*----------------------------------------------------------------*/
  739.     /* Local Variables                                                */
  740.     /*----------------------------------------------------------------*/
  741.     S32 sw, sh; /* string width/height */
  742.     S32 iw, ih; /* image width/height */
  743.     S32 cw;     /* content width */
  744.     S32 line_height, tmp_y;
  745.     S32 img_left_bound, img_left_lower_bound;
  746.     /*----------------------------------------------------------------*/
  747.     /* Code Body                                                      */
  748.     /*----------------------------------------------------------------*/
  749.     cw = CAT420_CTX->content_width = UI_device_width - current_MMI_theme->scrollbar_size;
  750.     gui_set_font(&MMI_medium_font);
  751.     /* Name */
  752.     Get_StringWidthHeight((U8*) CAT420_CTX->name, &sw, &sh);
  753.     if (sw > UI_device_width - (CAT420_LINE_EXTRA_PIXEL << 1))
  754.     {
  755.         sw = UI_device_width - (CAT420_LINE_EXTRA_PIXEL << 1);
  756.     }
  757.     CAT420_CTX->name_x = (cw - sw) >> 1;
  758.     CAT420_CTX->name_y = CAT420_TOP_MARGIN;
  759.     CAT420_CTX->name_width = sw;
  760.     CAT420_CTX->line_x1 = CAT420_CTX->name_x - CAT420_LINE_EXTRA_PIXEL;
  761.     CAT420_CTX->line_x2 = CAT420_CTX->name_x + sw + CAT420_LINE_EXTRA_PIXEL - 1;
  762.     if (CAT420_CTX->line_x1 < 0)
  763.     {
  764.         CAT420_CTX->line_x1 = 0;
  765.     }
  766.     if (CAT420_CTX->line_x2 >= cw)
  767.     {
  768.         CAT420_CTX->line_x2 = cw - 1;
  769.     }
  770.     CAT420_CTX->line_y = CAT420_CTX->name_y + sh + CAT420_NAME_LINE_V_SPACING;
  771.     img_left_lower_bound = 0;
  772.     /* Mood */
  773. #ifdef CAT420_DISP_INFO_TEXT
  774.     tmp_y = CAT420_CTX->line_y + CAT420_LINE_IMAGE_V_SPACING;
  775.     Get_StringWidthHeight((U8*) GetString(CAT420_CTX->mood_caption), &sw, &sh);
  776.     gui_measure_image(CAT420_CTX->mood_icon, &iw, &ih);
  777.     CAT420_CTX->mood_caption_x = CAT420_LEFT_MARGIN;
  778.     CAT420_CTX->mood_image_x = CAT420_CTX->mood_caption_x + sw + CAT420_CAPTION_IMAGE_H_SPACING;
  779.     line_height = sh > ih ? sh : ih;
  780.     CAT420_CTX->mood_caption_y = tmp_y + ((line_height - sh) >> 1);
  781.     CAT420_CTX->mood_image_y = tmp_y + ((line_height - ih) >> 1);
  782.     if (CAT420_CTX->mood_image_x + iw > img_left_lower_bound)
  783.     {
  784.         img_left_lower_bound = CAT420_CTX->mood_image_x + iw;
  785.     }
  786.     Get_StringWidthHeight((U8*) CAT420_CTX->mood_string, &sw, &sh);
  787.     CAT420_CTX->mood_text_x = CAT420_LEFT_MARGIN;
  788.     CAT420_CTX->mood_text_y = tmp_y + line_height + CAT420_MOOD_STATUS_V_SPACING;
  789.     if (CAT420_CTX->mood_text_x + sw > img_left_lower_bound)
  790.     {
  791.         img_left_lower_bound = CAT420_CTX->mood_text_x + sw;
  792.     }
  793. #else /* CAT420_DISP_INFO_TEXT */ 
  794.     UI_UNUSED_PARAMETER(line_height);
  795.     tmp_y = CAT420_CTX->line_y + CAT420_LINE_IMAGE_V_SPACING;
  796.     Get_StringWidthHeight((U8*) GetString(CAT420_CTX->mood_caption), &sw, &sh);
  797.     gui_measure_image(CAT420_CTX->mood_icon, &iw, &ih);
  798.     CAT420_CTX->mood_caption_x = CAT420_LEFT_MARGIN;
  799.     CAT420_CTX->mood_caption_y = tmp_y;
  800.     CAT420_CTX->mood_image_x = CAT420_LEFT_MARGIN;
  801.     CAT420_CTX->mood_image_y = tmp_y + sh + CAT420_MOOD_STATUS_V_SPACING;
  802.     if (CAT420_CTX->mood_caption_x + sw > img_left_lower_bound)
  803.     {
  804.         img_left_lower_bound = CAT420_CTX->mood_caption_x + sw;
  805.     }
  806.     if (CAT420_CTX->mood_image_x + iw > img_left_lower_bound)
  807.     {
  808.         img_left_lower_bound = CAT420_CTX->mood_image_x + iw;
  809.     }
  810. #endif /* CAT420_DISP_INFO_TEXT */ 
  811.     /* Status */
  812. #ifdef CAT420_DISP_INFO_TEXT
  813.     tmp_y = CAT420_CTX->mood_text_y + sh + CAT420_MOOD_STATUS_V_SPACING;
  814.     Get_StringWidthHeight((U8*) GetString(CAT420_CTX->status_caption), &sw, &sh);
  815.     gui_measure_image(CAT420_CTX->status_icon, &iw, &ih);
  816.     CAT420_CTX->status_caption_x = CAT420_LEFT_MARGIN;
  817.     CAT420_CTX->status_image_x = CAT420_CTX->status_caption_x + sw + CAT420_CAPTION_IMAGE_H_SPACING;
  818.     line_height = sh > ih ? sh : ih;
  819.     CAT420_CTX->status_caption_y = tmp_y + ((line_height - sh) >> 1);
  820.     CAT420_CTX->status_image_y = tmp_y + ((line_height - ih) >> 1);
  821.     if (CAT420_CTX->status_image_x + iw > img_left_lower_bound)
  822.     {
  823.         img_left_lower_bound = CAT420_CTX->status_image_x + iw;
  824.     }
  825.     Get_StringWidthHeight((U8*) CAT420_CTX->status_string, &sw, &sh);
  826.     CAT420_CTX->status_text_x = CAT420_LEFT_MARGIN;
  827.     CAT420_CTX->status_text_y = tmp_y + line_height + CAT420_MOOD_STATUS_V_SPACING;
  828.     if (CAT420_CTX->status_text_x + sw > img_left_lower_bound)
  829.     {
  830.         img_left_lower_bound = CAT420_CTX->status_text_x + sw;
  831.     }
  832. #else /* CAT420_DISP_INFO_TEXT */ 
  833.     tmp_y = CAT420_CTX->mood_image_y + ih + CAT420_MOOD_STATUS_V_SPACING;
  834.     Get_StringWidthHeight((U8*) GetString(CAT420_CTX->status_caption), &sw, &sh);
  835.     gui_measure_image(CAT420_CTX->status_icon, &iw, &ih);
  836.     CAT420_CTX->status_caption_x = CAT420_LEFT_MARGIN;
  837.     CAT420_CTX->status_caption_y = tmp_y;
  838.     CAT420_CTX->status_image_x = CAT420_LEFT_MARGIN;
  839.     CAT420_CTX->status_image_y = tmp_y + sh + CAT420_MOOD_STATUS_V_SPACING;
  840.     if (CAT420_CTX->status_caption_x + sw > img_left_lower_bound)
  841.     {
  842.         img_left_lower_bound = CAT420_CTX->status_caption_x + sw;
  843.     }
  844.     if (CAT420_CTX->status_image_x + iw > img_left_lower_bound)
  845.     {
  846.         img_left_lower_bound = CAT420_CTX->status_image_x + iw;
  847.     }
  848. #endif /* CAT420_DISP_INFO_TEXT */ 
  849.     /* Compute image width */
  850.     img_left_lower_bound += CAT420_IMAGE_H_SPACING;
  851.     if (img_left_lower_bound > cw - CAT420_RIGHT_MARGIN - CAT420_IMAGE_AREA_MIN_WIDTH)
  852.     {
  853.         img_left_lower_bound = cw - CAT420_RIGHT_MARGIN - CAT420_IMAGE_AREA_MIN_WIDTH;
  854.     }
  855.     img_left_bound = cw - CAT420_RIGHT_MARGIN - CAT420_IMAGE_AREA_WIDTH;
  856.     if (img_left_bound < img_left_lower_bound)
  857.     {
  858.         img_left_bound = img_left_lower_bound;
  859.     }
  860.     img_left_lower_bound -= CAT420_IMAGE_H_SPACING;
  861.     /* Total height */
  862. #ifdef CAT420_DISP_INFO_TEXT
  863.     CAT420_CTX->editor_header_height = CAT420_CTX->status_text_y + sh + CAT420_BOTTOM_MARGIN;
  864. #else 
  865.     CAT420_CTX->editor_header_height = CAT420_CTX->status_image_y + ih + CAT420_BOTTOM_MARGIN;
  866. #endif 
  867.     /* Image */
  868.     if (img_left_bound + CAT420_RIGHT_MARGIN >= cw || CAT420_CTX->image_ori_width == 0 ||
  869.         CAT420_CTX->image_ori_height == 0)
  870.     {
  871.         CAT420_CTX->display_image = MMI_FALSE;
  872.     }
  873.     CAT420_CTX->image_area_x = img_left_bound;
  874.     CAT420_CTX->image_area_y = CAT420_CTX->line_y + CAT420_LINE_IMAGE_V_SPACING;
  875.     CAT420_CTX->image_area_width = cw - CAT420_RIGHT_MARGIN - img_left_bound;
  876. #ifdef CAT420_DISP_INFO_TEXT
  877.     CAT420_CTX->image_area_height = CAT420_CTX->status_text_y + sh - CAT420_CTX->image_area_y;
  878. #else 
  879.     CAT420_CTX->image_area_height = CAT420_CTX->status_image_y + ih - CAT420_CTX->image_area_y;
  880. #endif 
  881.     /* Align text/icon to right for Arabic language */
  882.     if (r2lMMIFlag)
  883.     {
  884.         S32 xd;
  885.         /* Align mood to right */
  886.         xd = CAT420_CTX->mood_caption_x - CAT420_LEFT_MARGIN;
  887.         sw = gui_get_string_width((UI_string_type) GetString(CAT420_CTX->mood_caption));
  888.         CAT420_CTX->mood_caption_x = img_left_lower_bound - xd - sw + 1;
  889.         xd = CAT420_CTX->mood_image_x - CAT420_LEFT_MARGIN;
  890.         gui_measure_image(CAT420_CTX->mood_icon, &iw, &ih);
  891.         CAT420_CTX->mood_image_x = img_left_lower_bound - xd - iw + 1;
  892.     #ifdef CAT420_DISP_INFO_TEXT
  893.         xd = CAT420_CTX->mood_text_x - CAT420_LEFT_MARGIN;
  894.         sw = gui_get_string_width(CAT420_CTX->mood_string);
  895.         CAT420_CTX->mood_text_x = img_left_lower_bound - xd - sw + 1;
  896.     #endif /* CAT420_DISP_INFO_TEXT */ 
  897.         /* Align status to right */
  898.         xd = CAT420_CTX->status_caption_x - CAT420_LEFT_MARGIN;
  899.         sw = gui_get_string_width((UI_string_type) GetString(CAT420_CTX->status_caption));
  900.         CAT420_CTX->status_caption_x = img_left_lower_bound - xd - sw + 1;
  901.         xd = CAT420_CTX->status_image_x - CAT420_LEFT_MARGIN;
  902.         gui_measure_image(CAT420_CTX->status_icon, &iw, &ih);
  903.         CAT420_CTX->status_image_x = img_left_lower_bound - xd - iw + 1;
  904.     #ifdef CAT420_DISP_INFO_TEXT
  905.         xd = CAT420_CTX->status_text_x - CAT420_LEFT_MARGIN;
  906.         sw = gui_get_string_width(CAT420_CTX->status_string);
  907.         CAT420_CTX->status_text_x = img_left_lower_bound - xd - sw + 1;
  908.     #endif /* CAT420_DISP_INFO_TEXT */ 
  909.     }
  910.     /* Resize photo if required */
  911.     if (CAT420_CTX->display_image)
  912.     {
  913.         S32 zoom_offset_x, zoom_offset_y, zoom_size_width, zoom_size_height;
  914.         if (CAT420_CTX->image_ori_width <= CAT420_CTX->image_area_width &&
  915.             CAT420_CTX->image_ori_height <= CAT420_CTX->image_area_height)
  916.         {
  917.             zoom_offset_x = (CAT420_CTX->image_area_width - CAT420_CTX->image_ori_width) >> 1;
  918.             zoom_offset_y = (CAT420_CTX->image_area_height - CAT420_CTX->image_ori_height) >> 1;
  919.             zoom_size_width = 0;
  920.             zoom_size_height = 0;
  921.         }
  922.         else
  923.         {
  924.             gdi_image_util_fit_bbox(
  925.                 (S32) CAT420_CTX->image_area_width,
  926.                 (S32) CAT420_CTX->image_area_height,
  927.                 (S32) CAT420_CTX->image_ori_width,
  928.                 (S32) CAT420_CTX->image_ori_height,
  929.                 &zoom_offset_x,
  930.                 &zoom_offset_y,
  931.                 &zoom_size_width,
  932.                 &zoom_size_height);
  933.         }
  934.         CAT420_CTX->image_x_offset = (S16) CAT420_CTX->image_area_x + zoom_offset_x;
  935.         CAT420_CTX->image_y_offset = (S16) CAT420_CTX->image_area_y + zoom_offset_y;
  936.         CAT420_CTX->image_resized_width = (S16) zoom_size_width;
  937.         CAT420_CTX->image_resized_height = (S16) zoom_size_height;
  938.     }
  939. }
  940. /* FIXME. We may move image caching routines to wgui.c */
  941. /*****************************************************************************
  942.  * FUNCTION
  943.  *  category420_cache_image
  944.  * DESCRIPTION
  945.  *  
  946.  * PARAMETERS
  947.  *  image_path                  [?]         
  948.  *  alternative_image           [?]         
  949.  *  use_alternative_image       [IN]        
  950.  * RETURNS
  951.  *  void
  952.  *****************************************************************************/
  953. static void category420_cache_image(S8 *image_path, U8 *alternative_image, S32 use_alternative_image)
  954. {
  955.     /*----------------------------------------------------------------*/
  956.     /* Local Variables                                                */
  957.     /*----------------------------------------------------------------*/
  958.     /*----------------------------------------------------------------*/
  959.     /* Code Body                                                      */
  960.     /*----------------------------------------------------------------*/
  961.     if (!CAT420_CTX->display_image)
  962.     {
  963.         CAT420_CTX->image_is_cached = 0;
  964.         CAT420_CTX->cache_layer = GDI_LAYER_EMPTY_HANDLE;
  965.     }
  966.     else
  967.     {
  968.         CAT420_CTX->image_is_cached = 1;
  969.         gdi_layer_multi_layer_enable();
  970.         gdi_layer_create(0, 0, UI_device_width, UI_device_height, &CAT420_CTX->cache_layer);
  971.         gdi_layer_push_and_set_active(CAT420_CTX->cache_layer);
  972.         if (CAT420_CTX->image_resized_width == 0 || CAT420_CTX->image_resized_height == 0)
  973.         {
  974.             /* Fill background in case that the image is truncated */
  975.             gdi_draw_solid_rect(
  976.                 0,
  977.                 0,
  978.                 CAT420_CTX->image_ori_width,
  979.                 CAT420_CTX->image_ori_height,
  980.                 gdi_act_color_from_rgb(255, 255, 255, 255));
  981.             if (use_alternative_image)
  982.             {
  983.                 gdi_image_draw(0, 0, alternative_image);
  984.             }
  985.             else
  986.             {
  987.                 gdi_image_draw_file(0, 0, image_path);
  988.             }
  989.         }
  990.         else
  991.         {
  992.             gdi_draw_solid_rect(
  993.                 0,
  994.                 0,
  995.                 CAT420_CTX->image_resized_width,
  996.                 CAT420_CTX->image_resized_height,
  997.                 gdi_act_color_from_rgb(255, 255, 255, 255));
  998.             if (use_alternative_image)
  999.             {
  1000.                 gdi_image_draw_resized(
  1001.                     0,
  1002.                     0,
  1003.                     CAT420_CTX->image_resized_width,
  1004.                     CAT420_CTX->image_resized_height,
  1005.                     alternative_image);
  1006.             }
  1007.             else
  1008.             {
  1009.                 gdi_image_draw_resized_file(
  1010.                     0,
  1011.                     0,
  1012.                     CAT420_CTX->image_resized_width,
  1013.                     CAT420_CTX->image_resized_height,
  1014.                     image_path);
  1015.             }
  1016.         }
  1017.         gdi_layer_pop_and_restore_active();
  1018.     }
  1019. }
  1020. /* Free GDI layer of the image cache */
  1021. /*****************************************************************************
  1022.  * FUNCTION
  1023.  *  category420_free_image_cache
  1024.  * DESCRIPTION
  1025.  *  
  1026.  * PARAMETERS
  1027.  *  void
  1028.  * RETURNS
  1029.  *  void
  1030.  *****************************************************************************/
  1031. static void category420_free_image_cache(void)
  1032. {
  1033.     /*----------------------------------------------------------------*/
  1034.     /* Local Variables                                                */
  1035.     /*----------------------------------------------------------------*/
  1036.     /*----------------------------------------------------------------*/
  1037.     /* Code Body                                                      */
  1038.     /*----------------------------------------------------------------*/
  1039.     if (CAT420_CTX->image_is_cached)
  1040.     {
  1041.         gdi_layer_free(CAT420_CTX->cache_layer);
  1042.         gdi_layer_multi_layer_disable();
  1043.     }
  1044. }
  1045. /*****************************************************************************
  1046.  * FUNCTION
  1047.  *  category420_show_cached_image
  1048.  * DESCRIPTION
  1049.  *  
  1050.  * PARAMETERS
  1051.  *  x_offset        [IN]        
  1052.  *  y_offset        [IN]        
  1053.  *  width           [IN]        
  1054.  *  height          [IN]        
  1055.  * RETURNS
  1056.  *  void
  1057.  *****************************************************************************/
  1058. static void category420_show_cached_image(S32 x_offset, S32 y_offset, S32 width, S32 height)
  1059. {
  1060.     /*----------------------------------------------------------------*/
  1061.     /* Local Variables                                                */
  1062.     /*----------------------------------------------------------------*/
  1063.     S32 x1, y1, x2, y2, x, y, y_multiple;
  1064.     U16 *cached_buffer;
  1065.     /*----------------------------------------------------------------*/
  1066.     /* Code Body                                                      */
  1067.     /*----------------------------------------------------------------*/
  1068.     if (!CAT420_CTX->image_is_cached)
  1069.     {
  1070.         return;
  1071.     }
  1072.     /* Get clipping region inside the editor */
  1073.     gdi_layer_get_clip(&x1, &y1, &x2, &y2);
  1074.     gdi_layer_push_and_set_active(CAT420_CTX->cache_layer);
  1075.     gdi_layer_get_buffer_ptr((U8 **) & cached_buffer);
  1076.     gdi_layer_pop_and_restore_active();
  1077.     if (x1 < x_offset)
  1078.     {
  1079.         x1 = x_offset;
  1080.     }
  1081.     if (y1 < y_offset)
  1082.     {
  1083.         y1 = y_offset;
  1084.     }
  1085.     if (x2 > x_offset + width - 1)
  1086.     {
  1087.         x2 = x_offset + width - 1;
  1088.     }
  1089.     if (y2 > y_offset + height - 1)
  1090.     {
  1091.         y2 = y_offset + height - 1;
  1092.     }
  1093.     y_multiple = (y1 - y_offset) * UI_device_width;
  1094.     for (y = y1; y <= y2; y++)
  1095.     {
  1096.         for (x = x1; x <= x2; x++)
  1097.         {
  1098.             GDI_SET_BUFFER_PIXEL(x, y, cached_buffer[y_multiple + x - x_offset]);
  1099.         }
  1100.         y_multiple += UI_device_width;
  1101.     }
  1102. }
  1103. /*****************************************************************************
  1104.  * FUNCTION
  1105.  *  category420_header_callback
  1106.  * DESCRIPTION
  1107.  *  
  1108.  * PARAMETERS
  1109.  *  yoffset     [IN]        
  1110.  *  clip_x1     [IN]        
  1111.  *  clip_y1     [IN]        
  1112.  *  clip_x2     [IN]        
  1113.  *  clip_y2     [IN]        
  1114.  * RETURNS
  1115.  *  void
  1116.  *****************************************************************************/
  1117. static void category420_header_callback(S32 yoffset, S32 clip_x1, S32 clip_y1, S32 clip_x2, S32 clip_y2)
  1118. {
  1119.     /*----------------------------------------------------------------*/
  1120.     /* Local Variables                                                */
  1121.     /*----------------------------------------------------------------*/
  1122.     S32 sw, sh; /* string width/height */
  1123.     color tc;
  1124.     gdi_color c;
  1125.     S32 xoffset = 0;
  1126.     /*----------------------------------------------------------------*/
  1127.     /* Code Body                                                      */
  1128.     /*----------------------------------------------------------------*/
  1129.     /* Hack. xoffset should be provided in callback function */
  1130.     if (r2lMMIFlag)
  1131.     {
  1132.         xoffset = MMI_multiline_inputbox.vbar.width;
  1133.     }
  1134.     gui_push_clip();
  1135.     gui_push_text_clip();
  1136.     gui_set_clip(clip_x1, clip_y1, clip_x2, clip_y2);
  1137.     gui_set_text_clip(clip_x1, clip_y1, clip_x2, clip_y2);
  1138.     gui_set_font(&MMI_medium_font);
  1139.     tc.r = CAT420_TEXT_COLOR_R;
  1140.     tc.g = CAT420_TEXT_COLOR_G;
  1141.     tc.b = CAT420_TEXT_COLOR_B;
  1142.     tc.alpha = 100;
  1143.     gui_set_text_color(tc);
  1144.     c = gdi_act_color_from_rgb(255, CAT420_LINE_COLOR_R, CAT420_LINE_COLOR_G, CAT420_LINE_COLOR_B);
  1145.     /* Name */
  1146.     Get_StringWidthHeight((U8*) CAT420_CTX->name, &sw, &sh);
  1147.     if (sw > CAT420_CTX->name_width)
  1148.     {
  1149.         if (r2lMMIFlag)
  1150.         {
  1151.             gui_print_truncated_text(
  1152.                 xoffset + CAT420_CTX->name_x + CAT420_CTX->name_width - 1,
  1153.                 yoffset + CAT420_CTX->name_y,
  1154.                 CAT420_CTX->name_width,
  1155.                 CAT420_CTX->name);
  1156.         }
  1157.         else
  1158.         {
  1159.             gui_print_truncated_text(
  1160.                 xoffset + CAT420_CTX->name_x,
  1161.                 yoffset + CAT420_CTX->name_y,
  1162.                 CAT420_CTX->name_width,
  1163.                 CAT420_CTX->name);
  1164.         }
  1165.     }
  1166.     else
  1167.     {
  1168.         if (r2lMMIFlag)
  1169.         {
  1170.             gui_move_text_cursor(xoffset + CAT420_CTX->name_x + sw - 1, yoffset + CAT420_CTX->name_y);
  1171.         }
  1172.         else
  1173.         {
  1174.             gui_move_text_cursor(xoffset + CAT420_CTX->name_x, yoffset + CAT420_CTX->name_y);
  1175.         }
  1176.         gui_print_text(CAT420_CTX->name);
  1177.     }
  1178.     gdi_draw_line_style(
  1179.         xoffset + CAT420_CTX->line_x1,
  1180.         yoffset + CAT420_CTX->line_y,
  1181.         xoffset + CAT420_CTX->line_x2,
  1182.         yoffset + CAT420_CTX->line_y,
  1183.         c,
  1184.         sizeof(g_mmi_gui_cat420_line_style),
  1185.         g_mmi_gui_cat420_line_style);
  1186.     /* Mood */
  1187.     sw = gui_get_string_width((UI_string_type) GetString(CAT420_CTX->mood_caption));
  1188.     if (r2lMMIFlag)
  1189.     {
  1190.         gui_move_text_cursor(xoffset + CAT420_CTX->mood_caption_x + sw - 1, yoffset + CAT420_CTX->mood_caption_y);
  1191.     }
  1192.     else
  1193.     {
  1194.         gui_move_text_cursor(xoffset + CAT420_CTX->mood_caption_x, yoffset + CAT420_CTX->mood_caption_y);
  1195.     }
  1196.     gui_print_text((UI_string_type) GetString(CAT420_CTX->mood_caption));
  1197.     gui_show_transparent_image(
  1198.         xoffset + CAT420_CTX->mood_image_x,
  1199.         yoffset + CAT420_CTX->mood_image_y,
  1200.         CAT420_CTX->mood_icon,
  1201.         UI_DEFAULT_TRANSPARENT_COLOR);
  1202. #ifdef CAT420_DISP_INFO_TEXT
  1203.     sw = gui_get_string_width(CAT420_CTX->mood_string);
  1204.     if (r2lMMIFlag)
  1205.     {
  1206.         gui_move_text_cursor(xoffset + CAT420_CTX->mood_text_x + sw - 1, yoffset + CAT420_CTX->mood_text_y);
  1207.     }
  1208.     else
  1209.     {
  1210.         gui_move_text_cursor(xoffset + CAT420_CTX->mood_text_x, yoffset + CAT420_CTX->mood_text_y);
  1211.     }
  1212.     gui_print_text(CAT420_CTX->mood_string);
  1213. #endif /* CAT420_DISP_INFO_TEXT */ 
  1214.     /* Status */
  1215.     sw = gui_get_string_width((UI_string_type) GetString(CAT420_CTX->status_caption));
  1216.     if (r2lMMIFlag)
  1217.     {
  1218.         gui_move_text_cursor(xoffset + CAT420_CTX->status_caption_x + sw - 1, yoffset + CAT420_CTX->status_caption_y);
  1219.     }
  1220.     else
  1221.     {
  1222.         gui_move_text_cursor(xoffset + CAT420_CTX->status_caption_x, yoffset + CAT420_CTX->status_caption_y);
  1223.     }
  1224.     gui_print_text((UI_string_type) GetString(CAT420_CTX->status_caption));
  1225.     gui_show_transparent_image(
  1226.         xoffset + CAT420_CTX->status_image_x,
  1227.         yoffset + CAT420_CTX->status_image_y,
  1228.         CAT420_CTX->status_icon,
  1229.         UI_DEFAULT_TRANSPARENT_COLOR);
  1230. #ifdef CAT420_DISP_INFO_TEXT
  1231.     sw = gui_get_string_width(CAT420_CTX->status_string);
  1232.     if (r2lMMIFlag)
  1233.     {
  1234.         gui_move_text_cursor(xoffset + CAT420_CTX->status_text_x + sw - 1, yoffset + CAT420_CTX->status_text_y);
  1235.     }
  1236.     else
  1237.     {
  1238.         gui_move_text_cursor(xoffset + CAT420_CTX->status_text_x, yoffset + CAT420_CTX->status_text_y);
  1239.     }
  1240.     gui_print_text(CAT420_CTX->status_string);
  1241. #endif /* CAT420_DISP_INFO_TEXT */ 
  1242.     /* Image */
  1243.     if (CAT420_CTX->display_image)
  1244.     {
  1245.         if (CAT420_CTX->image_resized_width == 0 || CAT420_CTX->image_resized_height == 0)
  1246.         {
  1247.             category420_show_cached_image(
  1248.                 xoffset + CAT420_CTX->image_x_offset,
  1249.                 yoffset + CAT420_CTX->image_y_offset,
  1250.                 CAT420_CTX->image_ori_width,
  1251.                 CAT420_CTX->image_ori_height);
  1252.         }
  1253.         else
  1254.         {
  1255.             category420_show_cached_image(
  1256.                 xoffset + CAT420_CTX->image_x_offset,
  1257.                 yoffset + CAT420_CTX->image_y_offset,
  1258.                 CAT420_CTX->image_resized_width,
  1259.                 CAT420_CTX->image_resized_height);
  1260.         }
  1261.     }
  1262.     gdi_draw_rect(
  1263.         xoffset + CAT420_CTX->image_area_x - 1,
  1264.         yoffset + CAT420_CTX->image_area_y - 1,
  1265.         xoffset + CAT420_CTX->image_area_x + CAT420_CTX->image_area_width,
  1266.         yoffset + CAT420_CTX->image_area_y + CAT420_CTX->image_area_height,
  1267.         c);
  1268.     gui_pop_text_clip();
  1269.     gui_pop_clip();
  1270. }
  1271. /* 
  1272.  * Category 425
  1273.  */
  1274. /*****************************************************************************
  1275.  * FUNCTION
  1276.  *  category425_set_icontext_list_text_color
  1277.  * DESCRIPTION
  1278.  *  
  1279.  * PARAMETERS
  1280.  *  col     [IN]        
  1281.  *  c1      [IN]        
  1282.  *  c2      [IN]        
  1283.  * RETURNS
  1284.  *  void
  1285.  *****************************************************************************/
  1286. static void category425_set_icontext_list_text_color(int col, color c1, color c2)
  1287. {
  1288.     /*----------------------------------------------------------------*/
  1289.     /* Local Variables                                                */
  1290.     /*----------------------------------------------------------------*/
  1291.     /*----------------------------------------------------------------*/
  1292.     /* Code Body                                                      */
  1293.     /*----------------------------------------------------------------*/
  1294.     MMI_fixed_icontext_list_menuitem.normal_text_colors[col] = c1;
  1295.     MMI_fixed_icontext_list_menuitem.disabled_text_colors[col] = c1;
  1296.     MMI_fixed_icontext_list_menuitem.selected_text_colors[col] = c2;
  1297.     MMI_fixed_icontext_list_menuitem.focussed_text_colors[col] = c2;
  1298. }
  1299. /*****************************************************************************
  1300.  * FUNCTION
  1301.  *  category425_setup_text_color
  1302.  * DESCRIPTION
  1303.  *  
  1304.  * PARAMETERS
  1305.  *  void
  1306.  * RETURNS
  1307.  *  void
  1308.  *****************************************************************************/
  1309. static void category425_setup_text_color(void)
  1310. {
  1311.     /*----------------------------------------------------------------*/
  1312.     /* Local Variables                                                */
  1313.     /*----------------------------------------------------------------*/
  1314.     color c1, c2;
  1315.     /*----------------------------------------------------------------*/
  1316.     /* Code Body                                                      */
  1317.     /*----------------------------------------------------------------*/
  1318. #ifdef __MMI_MAINLCD_240X320__
  1319.     c1 = *current_MMI_theme->list_normal_text_color;
  1320.     c2 = *current_MMI_theme->list_selected_text_color;
  1321. #else /* __MMI_MAINLCD_240X320__ */ 
  1322.     c1.r = CAT425_TEXT1_COLOR_R;
  1323.     c1.g = CAT425_TEXT1_COLOR_G;
  1324.     c1.b = CAT425_TEXT1_COLOR_B;
  1325.     c2.r = CAT425_TEXT1_HIGHLIGHT_COLOR_R;
  1326.     c2.g = CAT425_TEXT1_HIGHLIGHT_COLOR_G;
  1327.     c2.b = CAT425_TEXT1_HIGHLIGHT_COLOR_B;
  1328. #endif /* __MMI_MAINLCD_240X320__ */ 
  1329.     category425_set_icontext_list_text_color(0, c1, c2);
  1330. #ifndef __MMI_MAINLCD_240X320__
  1331.     c1.r = CAT425_TEXT2_COLOR_R;
  1332.     c1.g = CAT425_TEXT2_COLOR_G;
  1333.     c1.b = CAT425_TEXT2_COLOR_B;
  1334.     c2.r = CAT425_TEXT2_HIGHLIGHT_COLOR_R;
  1335.     c2.g = CAT425_TEXT2_HIGHLIGHT_COLOR_G;
  1336.     c2.b = CAT425_TEXT2_HIGHLIGHT_COLOR_B;
  1337. #endif /* __MMI_MAINLCD_240X320__ */ 
  1338.     category425_set_icontext_list_text_color(1, c1, c2);
  1339. }
  1340. /*****************************************************************************
  1341.  * FUNCTION
  1342.  *  category425_reset_context
  1343.  * DESCRIPTION
  1344.  *  
  1345.  * PARAMETERS
  1346.  *  void
  1347.  * RETURNS
  1348.  *  void
  1349.  *****************************************************************************/
  1350. static void category425_reset_context(void)
  1351. {
  1352.     /*----------------------------------------------------------------*/
  1353.     /* Local Variables                                                */
  1354.     /*----------------------------------------------------------------*/
  1355.     /*----------------------------------------------------------------*/
  1356.     /* Code Body                                                      */
  1357.     /*----------------------------------------------------------------*/
  1358.     MMI_fixed_list_menu.flags = CAT425_CTX->backup_menu_flags;
  1359.     MMI_fixed_list_menu.normal_filler = CAT425_CTX->backup_menu_filler;
  1360.     fixed_icontext_list_menuitem_apply_current_theme();
  1361.     OslMfree(g_mmi_gui_cat425_context_p);
  1362.     g_mmi_gui_cat425_context_p = NULL;
  1363. }
  1364. /*****************************************************************************
  1365.  * FUNCTION
  1366.  *  category425_post_display_menuitem
  1367.  * DESCRIPTION
  1368.  *  
  1369.  * PARAMETERS
  1370.  *  item                    [?]         
  1371.  *  common_item_data        [?]         
  1372.  *  x                       [IN]        
  1373.  *  y                       [IN]        
  1374.  * RETURNS
  1375.  *  void
  1376.  *****************************************************************************/
  1377. static void category425_post_display_menuitem(void *item, void *common_item_data, S32 x, S32 y)
  1378. {
  1379.     /*----------------------------------------------------------------*/
  1380.     /* Local Variables                                                */
  1381.     /*----------------------------------------------------------------*/
  1382.     color c;
  1383.     fixed_icontext_list_menuitem *m = (fixed_icontext_list_menuitem*) common_item_data;
  1384.     fixed_icontext_list_menuitem_type *mi = (fixed_icontext_list_menuitem_type*) item;
  1385.     S32 x2, y2;
  1386.     gdi_color border_color;
  1387.     /*----------------------------------------------------------------*/
  1388.     /* Code Body                                                      */
  1389.     /*----------------------------------------------------------------*/
  1390.     x2 = x + m->width - 1;
  1391.     y2 = y + m->height - 1;
  1392.     gui_push_clip();
  1393.     gui_set_clip(x, y, x2, y2);
  1394.     border_color =
  1395.         (gdi_color) ((mi->flags & UI_MENUITEM_STATE_FOCUSSED) ?
  1396.                      gdi_act_color_from_rgb(
  1397.                         255,
  1398.                         CAT425_ICON_HIGHLIGHT_BORDER_COLOR_R,
  1399.                         CAT425_ICON_HIGHLIGHT_BORDER_COLOR_G,
  1400.                         CAT425_ICON_HIGHLIGHT_BORDER_COLOR_B) : gdi_act_color_from_rgb(
  1401.                                                                                         255,
  1402.                                                                                         CAT425_ICON_BORDER_COLOR_R,
  1403.                                                                                         CAT425_ICON_BORDER_COLOR_G,
  1404.                                                                                         CAT425_ICON_BORDER_COLOR_B));
  1405.     c.r = CAT425_TEXT2_BRACKET_COLOR_R;
  1406.     c.g = CAT425_TEXT2_BRACKET_COLOR_G;
  1407.     c.b = CAT425_TEXT2_BRACKET_COLOR_B;
  1408.     gui_set_text_color(c);
  1409.     if (r2lMMIFlag)
  1410.     {
  1411.         gui_move_text_cursor(x2 - CAT425_CTX->bracket_x, y + CAT425_CTX->bracket_y);
  1412.         gui_print_text((UI_string_type) L"]");
  1413.         gui_move_text_cursor(
  1414.             x2 - m->text_coordinates[1].x - m->text_coordinates[1].width - CAT425_TEXT2_BRACKET_GAP,
  1415.             y + CAT425_CTX->bracket_y);
  1416.         gui_print_text((UI_string_type) L"[");
  1417.         gdi_draw_rect(
  1418.             x2 - CAT425_CTX->icon_border_x1,
  1419.             y + CAT425_CTX->icon_border_y1,
  1420.             x2 - CAT425_CTX->icon_border_x2,
  1421.             y + CAT425_CTX->icon_border_y2,
  1422.             border_color);
  1423.     }
  1424.     else
  1425.     {
  1426.         gui_move_text_cursor(x + CAT425_CTX->bracket_x, y + CAT425_CTX->bracket_y);
  1427.         gui_print_text((UI_string_type) L"[");
  1428.         gui_move_text_cursor(
  1429.             x + m->text_coordinates[1].x + m->text_coordinates[1].width + CAT425_TEXT2_BRACKET_GAP,
  1430.             y + CAT425_CTX->bracket_y);
  1431.         gui_print_text((UI_string_type) L"]");
  1432.         gdi_draw_rect(
  1433.             x + CAT425_CTX->icon_border_x1,
  1434.             y + CAT425_CTX->icon_border_y1,
  1435.             x + CAT425_CTX->icon_border_x2,
  1436.             y + CAT425_CTX->icon_border_y2,
  1437.             border_color);
  1438.     }
  1439.     gdi_draw_line_style(
  1440.         x,
  1441.         y2,
  1442.         x2,
  1443.         y2,
  1444.         gdi_act_color_from_rgb(255, CAT425_LINE_COLOR_R, CAT425_LINE_COLOR_G, CAT425_LINE_COLOR_B),
  1445.         sizeof(g_mmi_gui_cat425_line_bitvalues),
  1446.         g_mmi_gui_cat425_line_bitvalues);
  1447.     gui_pop_clip();
  1448. }
  1449. /* 
  1450.  * Category 430
  1451.  */
  1452. /* b is configured, and b->height is computed */
  1453. /*****************************************************************************
  1454.  * FUNCTION
  1455.  *  category430_create_sending_box
  1456.  * DESCRIPTION
  1457.  *  
  1458.  * PARAMETERS
  1459.  *  b       [?]         
  1460.  *  x       [IN]        
  1461.  *  y       [IN]        
  1462.  * RETURNS
  1463.  *  void
  1464.  *****************************************************************************/
  1465. static void category430_create_sending_box(multi_line_input_box *b, S16 x, S16 y)
  1466. {
  1467.     /*----------------------------------------------------------------*/
  1468.     /* Local Variables                                                */
  1469.     /*----------------------------------------------------------------*/
  1470.     S32 length;
  1471.     S32 read_index;
  1472.     wgui_color_buffer_writer_struct writer;
  1473.     S32 h;
  1474.     /*----------------------------------------------------------------*/
  1475.     /* Code Body                                                      */
  1476.     /*----------------------------------------------------------------*/
  1477.     length = gui_strlen((UI_string_type) CAT430_CTX->sending_buffer);
  1478.     /* Create color text buffer */
  1479.     MMI_ASSERT(CAT430_CTX->sent_count <= length && length <= CAT430_CTX->max_sending_buffer_size);
  1480.     CAT430_CTX->allocated_color_buffer[0] = CAT430_CTX->allocated_color_buffer[1] = 0;
  1481.     wgui_color_buffer_create_writer(
  1482.         &writer,
  1483.         CAT430_CTX->allocated_color_buffer,
  1484.         CAT430_CTX->allocated_color_buffer_size);
  1485.     wgui_color_buffer_write_char(&writer, GUI_INPUT_COLOR_BLACK);
  1486.     for (read_index = 0; read_index < CAT430_CTX->sent_count; read_index++)
  1487.     {
  1488.         wgui_color_buffer_write_char(&writer, *((U16*) & CAT430_CTX->sending_buffer[read_index << 1]));
  1489.     }
  1490.     wgui_color_buffer_write_char(&writer, GUI_INPUT_COLOR_TEAL);
  1491.     for (read_index = CAT430_CTX->sent_count; read_index < length; read_index++)
  1492.     {
  1493.         wgui_color_buffer_write_char(&writer, *((U16*) & CAT430_CTX->sending_buffer[read_index << 1]));
  1494.     }
  1495.     gui_create_multi_line_input_box_set_buffer(
  1496.         b,
  1497.         x,
  1498.         y,
  1499.         CAT430_CTX->sending_box_width,
  1500.         UI_device_height /* max height */ ,
  1501.         (UI_string_type) CAT430_CTX->allocated_color_buffer,
  1502.         CAT430_CTX->max_sending_buffer_size * 2,
  1503.         (length + 1) * 2,
  1504.         0);
  1505.     b->flags |=
  1506.         (UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE |
  1507.          UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR | UI_MULTI_LINE_INPUT_BOX_RICHTEXT);
  1508.     b->normal_filler = (UI_filled_area*)&g_mmi_gui_cat430_sending_filler;
  1509.     /* Compute text height and adjust scroll offset */
  1510.     b->flags |= UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
  1511.     gui_show_multi_line_input_box(b);
  1512.     b->flags &= ~UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
  1513.     /* Setup height */
  1514.     h = b->text_height + b->text_y;
  1515.     gui_resize_multi_line_input_box(b, b->width, h);
  1516. }
  1517. /*****************************************************************************
  1518.  * FUNCTION
  1519.  *  category430_setup_sending_box
  1520.  * DESCRIPTION
  1521.  *  
  1522.  * PARAMETERS
  1523.  *  void
  1524.  * RETURNS
  1525.  *  void
  1526.  *****************************************************************************/
  1527. static void category430_setup_sending_box(void)
  1528. {
  1529.     /*----------------------------------------------------------------*/
  1530.     /* Local Variables                                                */
  1531.     /*----------------------------------------------------------------*/
  1532.     multi_line_input_box b;
  1533.     /*----------------------------------------------------------------*/
  1534.     /* Code Body                                                      */
  1535.     /*----------------------------------------------------------------*/
  1536.     if (CAT430_CTX->show_sending_buffer)
  1537.     {
  1538.         CAT430_CTX->sending_box_x = CAT430_SENDING_BOX_H_GAP;
  1539.         CAT430_CTX->sending_box_y = CAT430_SENDING_BOX_V_GAP;
  1540.         CAT430_CTX->sending_box_width = CAT430_CTX->log_box2_width -
  1541.             2 * CAT430_SENDING_BOX_H_GAP - current_multi_line_input_box_theme->vbar_width;
  1542.         category430_create_sending_box(&b, 0, 0);
  1543.         CAT430_CTX->log_box2_footer_height = b.height + 2 * CAT430_SENDING_BOX_V_GAP;
  1544.     }
  1545.     else
  1546.     {
  1547.         CAT430_CTX->log_box2_footer_height = 0;
  1548.     }
  1549. }
  1550. #ifdef CAT430_NAME_IN_LOG
  1551. /*****************************************************************************
  1552.  * FUNCTION
  1553.  *  category430_header1_callback
  1554.  * DESCRIPTION
  1555.  *  
  1556.  * PARAMETERS
  1557.  *  yoffset     [IN]        
  1558.  *  clip_x1     [IN]        
  1559.  *  clip_y1     [IN]        
  1560.  *  clip_x2     [IN]        
  1561.  *  clip_y2     [IN]        
  1562.  * RETURNS
  1563.  *  void
  1564.  *****************************************************************************/
  1565. static void category430_header1_callback(S32 yoffset, S32 clip_x1, S32 clip_y1, S32 clip_x2, S32 clip_y2)
  1566. {
  1567.     /*----------------------------------------------------------------*/
  1568.     /* Local Variables                                                */
  1569.     /*----------------------------------------------------------------*/
  1570.     S32 sw;
  1571.     /*----------------------------------------------------------------*/
  1572.     /* Code Body                                                      */
  1573.     /*----------------------------------------------------------------*/
  1574.     gui_push_clip();
  1575.     gui_set_clip(clip_x1, clip_y1, clip_x2, clip_y2);
  1576.     gui_set_font(CAT430_NAME_FONT);
  1577.     sw = gui_get_string_width((UI_string_type) CAT430_CTX->name1);
  1578.     if (r2lMMIFlag)
  1579.     {
  1580.         gui_move_text_cursor(CAT430_CTX->log_box1_x + CAT430_HORIZONTAL_GAP + sw - 1, yoffset);
  1581.     }
  1582.     else
  1583.     {
  1584.         gui_move_text_cursor(CAT430_CTX->log_box1_x + CAT430_HORIZONTAL_GAP, yoffset);
  1585.     }
  1586.     gui_set_text_color(gui_color(CAT430_NAME1_COLOR_R, CAT430_NAME1_COLOR_G, CAT430_NAME1_COLOR_B));
  1587.     gui_print_text((UI_string_type) CAT430_CTX->name1);
  1588.     gui_pop_clip();
  1589. }
  1590. /*****************************************************************************
  1591.  * FUNCTION
  1592.  *  category430_header2_callback
  1593.  * DESCRIPTION
  1594.  *  
  1595.  * PARAMETERS
  1596.  *  yoffset     [IN]        
  1597.  *  clip_x1     [IN]        
  1598.  *  clip_y1     [IN]        
  1599.  *  clip_x2     [IN]        
  1600.  *  clip_y2     [IN]        
  1601.  * RETURNS
  1602.  *  void
  1603.  *****************************************************************************/
  1604. static void category430_header2_callback(S32 yoffset, S32 clip_x1, S32 clip_y1, S32 clip_x2, S32 clip_y2)
  1605. {
  1606.     /*----------------------------------------------------------------*/
  1607.     /* Local Variables                                                */
  1608.     /*----------------------------------------------------------------*/
  1609.     S32 sw;
  1610.     /*----------------------------------------------------------------*/
  1611.     /* Code Body                                                      */
  1612.     /*----------------------------------------------------------------*/
  1613.     gui_push_clip();
  1614.     gui_set_clip(clip_x1, clip_y1, clip_x2, clip_y2);
  1615.     gui_set_font(CAT430_NAME_FONT);
  1616.     sw = gui_get_string_width((UI_string_type) CAT430_CTX->name2);
  1617.     if (r2lMMIFlag)
  1618.     {
  1619.         gui_move_text_cursor(CAT430_CTX->log_box2_x + CAT430_HORIZONTAL_GAP + sw - 1, yoffset);
  1620.     }
  1621.     else
  1622.     {
  1623.         gui_move_text_cursor(CAT430_CTX->log_box2_x + CAT430_HORIZONTAL_GAP, yoffset);
  1624.     }
  1625.     gui_set_text_color(gui_color(CAT430_NAME2_COLOR_R, CAT430_NAME2_COLOR_G, CAT430_NAME2_COLOR_B));
  1626.     gui_print_text((UI_string_type) CAT430_CTX->name2);
  1627.     gui_pop_clip();
  1628. }
  1629. #endif /* CAT430_NAME_IN_LOG */ 
  1630. /*****************************************************************************
  1631.  * FUNCTION
  1632.  *  category430_footer_callback
  1633.  * DESCRIPTION
  1634.  *  
  1635.  * PARAMETERS
  1636.  *  yoffset     [IN]        
  1637.  *  clip_x1     [IN]        
  1638.  *  clip_y1     [IN]        
  1639.  *  clip_x2     [IN]        
  1640.  *  clip_y2     [IN]        
  1641.  * RETURNS
  1642.  *  void
  1643.  *****************************************************************************/
  1644. static void category430_footer_callback(S32 yoffset, S32 clip_x1, S32 clip_y1, S32 clip_x2, S32 clip_y2)
  1645. {
  1646.     /*----------------------------------------------------------------*/
  1647.     /* Local Variables                                                */
  1648.     /*----------------------------------------------------------------*/
  1649.     multi_line_input_box b;
  1650.     /*----------------------------------------------------------------*/
  1651.     /* Code Body                                                      */
  1652.     /*----------------------------------------------------------------*/
  1653.     category430_create_sending_box(&b, (S16) CAT430_CTX->sending_box_x, (S16) (yoffset + CAT430_CTX->sending_box_y));
  1654.     b.flags |= UI_MULTI_LINE_INPUT_BOX_USE_PRESET_CLIPPING;
  1655.     gui_push_clip();
  1656.     gui_set_clip(clip_x1, clip_y1, clip_x2, clip_y2);
  1657.     gui_show_multi_line_input_box(&b);
  1658.     gui_pop_clip();
  1659. }
  1660. /*****************************************************************************
  1661.  * FUNCTION
  1662.  *  category430_setup_log_box1
  1663.  * DESCRIPTION
  1664.  *  
  1665.  * PARAMETERS
  1666.  *  void
  1667.  * RETURNS
  1668.  *  void
  1669.  *****************************************************************************/
  1670. static void category430_setup_log_box1(void)
  1671. {
  1672.     /*----------------------------------------------------------------*/
  1673.     /* Local Variables                                                */
  1674.     /*----------------------------------------------------------------*/
  1675.     /*
  1676.      * In Arabic, the ailgnment format is decided by the content of file. 
  1677.      * * MSN align chat log to left.
  1678.      */
  1679.     S32 log_length;
  1680.     multi_line_input_box *b = &CAT430_CTX->log_box1;
  1681.     /*----------------------------------------------------------------*/
  1682.     /* Code Body                                                      */
  1683.     /*----------------------------------------------------------------*/
  1684.     log_length = gui_strlen((UI_string_type) CAT430_CTX->log_buffer1);
  1685.     gui_create_multi_line_input_box_set_buffer(
  1686.         b,
  1687.         CAT430_CTX->log_box1_x,
  1688.         CAT430_CTX->log_box1_y,
  1689.         CAT430_CTX->log_box1_width,
  1690.         CAT430_CTX->log_box1_height,
  1691.         (UI_string_type) CAT430_CTX->log_buffer1,
  1692.         CAT430_CTX->log_buffer_size1 * 2,
  1693.         (log_length + 1) * 2,
  1694.         0);
  1695. #ifdef CAT430_NAME_IN_LOG
  1696.     b->header_height = CAT430_CTX->log_box_header_height;
  1697.     b->header_callback = category430_header1_callback;
  1698. #endif /* CAT430_NAME_IN_LOG */ 
  1699.     b->flags |= (UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE);
  1700.     b->normal_filler = (UI_filled_area*)&g_mmi_gui_cat430_logbox_filler;
  1701.     /* Compute text height and adjust scroll offset */
  1702.     b->flags |= UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
  1703.     gui_show_multi_line_input_box(b);
  1704.     b->flags &= ~UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
  1705.     if (b->text_height > b->edit_height)
  1706.     {
  1707.         b->text_offset_y = -(b->text_height - b->edit_height);
  1708.     }
  1709. }
  1710. /*****************************************************************************
  1711.  * FUNCTION
  1712.  *  category430_setup_log_box2
  1713.  * DESCRIPTION
  1714.  *  
  1715.  * PARAMETERS
  1716.  *  void
  1717.  * RETURNS
  1718.  *  void
  1719.  *****************************************************************************/
  1720. static void category430_setup_log_box2(void)
  1721. {
  1722.     /*----------------------------------------------------------------*/
  1723.     /* Local Variables                                                */
  1724.     /*----------------------------------------------------------------*/
  1725.     /*
  1726.      * In Arabic, the ailgnment format is decided by the content of file. 
  1727.      * * MSN align chat log to left.
  1728.      */
  1729.     S32 log_length;
  1730.     multi_line_input_box *b = &MMI_multiline_inputbox;
  1731.     /*----------------------------------------------------------------*/
  1732.     /* Code Body                                                      */
  1733.     /*----------------------------------------------------------------*/
  1734.     log_length = gui_strlen((UI_string_type) CAT430_CTX->log_buffer2);
  1735.     gui_create_multi_line_input_box_set_buffer(
  1736.         b,
  1737.         CAT430_CTX->log_box2_x,
  1738.         CAT430_CTX->log_box2_y,
  1739.         CAT430_CTX->log_box2_width,
  1740.         CAT430_CTX->log_box2_height,
  1741.         (UI_string_type) CAT430_CTX->log_buffer2,
  1742.         CAT430_CTX->log_buffer_size2 * 2,
  1743.         (log_length + 1) * 2,
  1744.         0);
  1745. #ifdef CAT430_NAME_IN_LOG
  1746.     b->header_height = CAT430_CTX->log_box_header_height;
  1747.     b->header_callback = category430_header2_callback;
  1748. #endif /* CAT430_NAME_IN_LOG */ 
  1749.     b->footer_height = CAT430_CTX->log_box2_footer_height;
  1750.     b->footer_callback = category430_footer_callback;
  1751.     b->max_empty_text_height = 1;   /* For the case sending box is not empty but log box2 is empty. */
  1752.     b->flags |= (UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE);
  1753.     b->normal_filler = (UI_filled_area*)&g_mmi_gui_cat430_logbox_filler;
  1754.     /* Compute text height and adjust scroll offset */
  1755.     b->flags |= UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
  1756.     gui_show_multi_line_input_box(b);
  1757.     b->flags &= ~UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
  1758.     if (b->text_height > b->edit_height)
  1759.     {
  1760.         b->text_offset_y = -(b->text_height - b->edit_height);
  1761.     }
  1762. }
  1763. /*****************************************************************************
  1764.  * FUNCTION
  1765.  *  category430_draw_content_area
  1766.  * DESCRIPTION
  1767.  *  
  1768.  * PARAMETERS
  1769.  *  void
  1770.  * RETURNS
  1771.  *  void
  1772.  *****************************************************************************/
  1773. void category430_draw_content_area(void)
  1774. {
  1775.     /*----------------------------------------------------------------*/
  1776.     /* Local Variables                                                */
  1777.     /*----------------------------------------------------------------*/
  1778. #ifndef CAT430_NAME_IN_LOG
  1779.     S32 sw;
  1780. #endif 
  1781.     /*----------------------------------------------------------------*/
  1782.     /* Code Body                                                      */
  1783.     /*----------------------------------------------------------------*/
  1784. #ifndef __MMI_WALLPAPER_ON_BOTTOM__
  1785.     gui_draw_filled_area(
  1786.         MMI_content_x,
  1787.         MMI_content_y,
  1788.         MMI_content_x + MMI_content_width - 1,
  1789.         MMI_content_y + MMI_content_height - 1,
  1790.         MMI_fixed_list_menu.normal_filler);
  1791. #endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 
  1792. #ifndef CAT430_NAME_IN_LOG
  1793.     gui_set_font(CAT430_NAME_FONT);
  1794.     sw = gui_get_string_width((UI_string_type) CAT430_CTX->name1);
  1795.     if (r2lMMIFlag)
  1796.     {
  1797.         gui_move_text_cursor(CAT430_CTX->name1_x + sw - 1, CAT430_CTX->name1_y);
  1798.     }
  1799.     else
  1800.     {
  1801.         gui_move_text_cursor(CAT430_CTX->name1_x, CAT430_CTX->name1_y);
  1802.     }
  1803.     gui_set_text_color(gui_color(CAT430_NAME1_COLOR_R, CAT430_NAME1_COLOR_G, CAT430_NAME1_COLOR_B));
  1804.     gui_print_text((UI_string_type) CAT430_CTX->name1);
  1805.     sw = gui_get_string_width((UI_string_type) CAT430_CTX->name2);
  1806.     if (r2lMMIFlag)
  1807.     {
  1808.         gui_move_text_cursor(CAT430_CTX->name2_x + sw - 1, CAT430_CTX->name2_y);
  1809.     }
  1810.     else
  1811.     {
  1812.         gui_move_text_cursor(CAT430_CTX->name2_x, CAT430_CTX->name2_y);
  1813.     }
  1814.     gui_set_text_color(gui_color(CAT430_NAME2_COLOR_R, CAT430_NAME2_COLOR_G, CAT430_NAME2_COLOR_B));
  1815.     gui_print_text((UI_string_type) CAT430_CTX->name2);
  1816. #endif /* CAT430_NAME_IN_LOG */ 
  1817.     gui_show_multi_line_input_box(&CAT430_CTX->log_box1);
  1818.     gui_show_multi_line_input_box(&MMI_multiline_inputbox);
  1819. }
  1820. /*****************************************************************************
  1821.  * FUNCTION
  1822.  *  category430_previous_line
  1823.  * DESCRIPTION
  1824.  *  
  1825.  * PARAMETERS
  1826.  *  void
  1827.  * RETURNS
  1828.  *  void
  1829.  *****************************************************************************/
  1830. void category430_previous_line(void)
  1831. {
  1832.     /*----------------------------------------------------------------*/
  1833.     /* Local Variables                                                */
  1834.     /*----------------------------------------------------------------*/
  1835.     /*----------------------------------------------------------------*/
  1836.     /* Code Body                                                      */
  1837.     /*----------------------------------------------------------------*/
  1838.     gui_lock_double_buffer();
  1839.     gui_multi_line_input_box_previous_line(&CAT430_CTX->log_box1);
  1840.     gui_show_multi_line_input_box(&CAT430_CTX->log_box1);
  1841.     gui_multi_line_input_box_previous_line(&MMI_multiline_inputbox);
  1842.     gui_show_multi_line_input_box(&MMI_multiline_inputbox);
  1843.     gui_unlock_double_buffer();
  1844.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  1845. }
  1846. /*****************************************************************************
  1847.  * FUNCTION
  1848.  *  category430_next_line
  1849.  * DESCRIPTION
  1850.  *  
  1851.  * PARAMETERS
  1852.  *  void
  1853.  * RETURNS
  1854.  *  void
  1855.  *****************************************************************************/
  1856. void category430_next_line(void)
  1857. {
  1858.     /*----------------------------------------------------------------*/
  1859.     /* Local Variables                                                */
  1860.     /*----------------------------------------------------------------*/
  1861.     /*----------------------------------------------------------------*/
  1862.     /* Code Body                                                      */
  1863.     /*----------------------------------------------------------------*/
  1864.     gui_lock_double_buffer();
  1865.     gui_multi_line_input_box_next_line(&CAT430_CTX->log_box1);
  1866.     gui_show_multi_line_input_box(&CAT430_CTX->log_box1);
  1867.     gui_multi_line_input_box_next_line(&MMI_multiline_inputbox);
  1868.     gui_show_multi_line_input_box(&MMI_multiline_inputbox);
  1869.     gui_unlock_double_buffer();
  1870.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  1871. }
  1872. /*****************************************************************************
  1873.  * FUNCTION
  1874.  *  category430_draw_controlled_area
  1875.  * DESCRIPTION
  1876.  *  
  1877.  * PARAMETERS
  1878.  *  coordinate      [?]     
  1879.  * RETURNS
  1880.  *  void
  1881.  *****************************************************************************/
  1882. void category430_draw_controlled_area(dm_coordinates *coordinate)
  1883. {
  1884.     /*----------------------------------------------------------------*/
  1885.     /* Local Variables                                                */
  1886.     /*----------------------------------------------------------------*/
  1887.     /*----------------------------------------------------------------*/
  1888.     /* Code Body                                                      */
  1889.     /*----------------------------------------------------------------*/
  1890.     category430_draw_content_area();
  1891. }
  1892. #ifdef __MMI_TOUCH_SCREEN__
  1893. /*****************************************************************************
  1894.  * FUNCTION
  1895.  *  category430_control_area_pen_handler
  1896.  * DESCRIPTION
  1897.  *  
  1898.  * PARAMETERS
  1899.  *  point           [IN]        
  1900.  *  pen_event       [IN]        
  1901.  * RETURNS
  1902.  *  
  1903.  *****************************************************************************/
  1904. static MMI_BOOL category430_control_area_pen_handler(mmi_pen_point_struct point, mmi_pen_event_type_enum pen_event)
  1905. {
  1906.     /*----------------------------------------------------------------*/
  1907.     /* Local Variables                                                */
  1908.     /*----------------------------------------------------------------*/
  1909.     gui_multi_line_input_box_pen_enum event;
  1910.     /*----------------------------------------------------------------*/
  1911.     /* Code Body                                                      */
  1912.     /*----------------------------------------------------------------*/
  1913.     if (!CAT430_CTX)
  1914.     {
  1915.         MMI_DBG_ASSERT(0);
  1916.         return MMI_FALSE;
  1917.     }
  1918.     if (pen_event == MMI_PEN_EVENT_DOWN)
  1919.     {
  1920.         CAT430_CTX->pen_object = 0;
  1921.         if (gui_multi_line_input_box_translate_pen_event(&CAT430_CTX->log_box1, pen_event, point.x, point.y, &event))
  1922.         {
  1923.             CAT430_CTX->pen_object = 1;
  1924.             return MMI_TRUE;
  1925.         }
  1926.         if (gui_multi_line_input_box_translate_pen_event(&MMI_multiline_inputbox, pen_event, point.x, point.y, &event))
  1927.         {
  1928.             CAT430_CTX->pen_object = 2;
  1929.             return MMI_TRUE;
  1930.         }
  1931.         else
  1932.         {
  1933.             return MMI_FALSE;
  1934.         }
  1935.     }
  1936.     else
  1937.     {
  1938.         switch (CAT430_CTX->pen_object)
  1939.         {
  1940.             case 1:
  1941.                 return gui_multi_line_input_box_translate_pen_event(
  1942.                         &CAT430_CTX->log_box1,
  1943.                         pen_event,
  1944.                         point.x,
  1945.                         point.y,
  1946.                         &event);
  1947.             case 2:
  1948.                 return gui_multi_line_input_box_translate_pen_event(
  1949.                         &MMI_multiline_inputbox,
  1950.                         pen_event,
  1951.                         point.x,
  1952.                         point.y,
  1953.                         &event);
  1954.             default:
  1955.                 return MMI_TRUE;
  1956.         }
  1957.     }
  1958. }
  1959. /*****************************************************************************
  1960.  * FUNCTION
  1961.  *  category430_control_area_pen_down_handler
  1962.  * DESCRIPTION
  1963.  *  
  1964.  * PARAMETERS
  1965.  *  point       [IN]        
  1966.  * RETURNS
  1967.  *  
  1968.  *****************************************************************************/
  1969. static MMI_BOOL category430_control_area_pen_down_handler(mmi_pen_point_struct point)
  1970. {
  1971.     /*----------------------------------------------------------------*/
  1972.     /* Local Variables                                                */
  1973.     /*----------------------------------------------------------------*/
  1974.     /*----------------------------------------------------------------*/
  1975.     /* Code Body                                                      */
  1976.     /*----------------------------------------------------------------*/
  1977.     return category430_control_area_pen_handler(point, MMI_PEN_EVENT_DOWN);
  1978. }
  1979. /*****************************************************************************
  1980.  * FUNCTION
  1981.  *  category430_control_area_pen_move_handler
  1982.  * DESCRIPTION
  1983.  *  
  1984.  * PARAMETERS
  1985.  *  point       [IN]        
  1986.  * RETURNS
  1987.  *  
  1988.  *****************************************************************************/
  1989. static MMI_BOOL category430_control_area_pen_move_handler(mmi_pen_point_struct point)
  1990. {
  1991.     /*----------------------------------------------------------------*/
  1992.     /* Local Variables                                                */
  1993.     /*----------------------------------------------------------------*/
  1994.     /*----------------------------------------------------------------*/
  1995.     /* Code Body                                                      */
  1996.     /*----------------------------------------------------------------*/
  1997.     return category430_control_area_pen_handler(point, MMI_PEN_EVENT_MOVE);
  1998. }
  1999. /*****************************************************************************
  2000.  * FUNCTION
  2001.  *  category430_control_area_pen_longtap_handler
  2002.  * DESCRIPTION
  2003.  *  
  2004.  * PARAMETERS
  2005.  *  point       [IN]        
  2006.  * RETURNS
  2007.  *  
  2008.  *****************************************************************************/
  2009. static MMI_BOOL category430_control_area_pen_longtap_handler(mmi_pen_point_struct point)
  2010. {
  2011.     /*----------------------------------------------------------------*/
  2012.     /* Local Variables                                                */
  2013.     /*----------------------------------------------------------------*/
  2014.     /*----------------------------------------------------------------*/
  2015.     /* Code Body                                                      */
  2016.     /*----------------------------------------------------------------*/
  2017.     return category430_control_area_pen_handler(point, MMI_PEN_EVENT_LONG_TAP);
  2018. }
  2019. /*****************************************************************************
  2020.  * FUNCTION
  2021.  *  category430_control_area_pen_repeat_handler
  2022.  * DESCRIPTION
  2023.  *  
  2024.  * PARAMETERS
  2025.  *  point       [IN]        
  2026.  * RETURNS
  2027.  *  
  2028.  *****************************************************************************/
  2029. static MMI_BOOL category430_control_area_pen_repeat_handler(mmi_pen_point_struct point)
  2030. {
  2031.     /*----------------------------------------------------------------*/
  2032.     /* Local Variables                                                */
  2033.     /*----------------------------------------------------------------*/
  2034.     /*----------------------------------------------------------------*/
  2035.     /* Code Body                                                      */
  2036.     /*----------------------------------------------------------------*/
  2037.     return category430_control_area_pen_handler(point, MMI_PEN_EVENT_REPEAT);
  2038. }
  2039. /*****************************************************************************
  2040.  * FUNCTION
  2041.  *  category430_control_area_pen_up_handler
  2042.  * DESCRIPTION
  2043.  *  
  2044.  * PARAMETERS
  2045.  *  point       [IN]        
  2046.  * RETURNS
  2047.  *  
  2048.  *****************************************************************************/
  2049. static MMI_BOOL category430_control_area_pen_up_handler(mmi_pen_point_struct point)
  2050. {
  2051.     /*----------------------------------------------------------------*/
  2052.     /* Local Variables                                                */
  2053.     /*----------------------------------------------------------------*/
  2054.     /*----------------------------------------------------------------*/
  2055.     /* Code Body                                                      */
  2056.     /*----------------------------------------------------------------*/
  2057.     return category430_control_area_pen_handler(point, MMI_PEN_EVENT_UP);
  2058. }
  2059. /*****************************************************************************
  2060.  * FUNCTION
  2061.  *  category430_control_area_pen_abort_handler
  2062.  * DESCRIPTION
  2063.  *  
  2064.  * PARAMETERS
  2065.  *  point       [IN]        
  2066.  * RETURNS
  2067.  *  
  2068.  *****************************************************************************/
  2069. static MMI_BOOL category430_control_area_pen_abort_handler(mmi_pen_point_struct point)
  2070. {
  2071.     /*----------------------------------------------------------------*/
  2072.     /* Local Variables                                                */
  2073.     /*----------------------------------------------------------------*/
  2074.     /*----------------------------------------------------------------*/
  2075.     /* Code Body                                                      */
  2076.     /*----------------------------------------------------------------*/
  2077.     return category430_control_area_pen_handler(point, MMI_PEN_EVENT_ABORT);
  2078. }
  2079. #endif /* __MMI_TOUCH_SCREEN__ */ 
  2080. /* 
  2081.  * Category 435
  2082.  */
  2083. /*****************************************************************************
  2084.  * FUNCTION
  2085.  *  category435_hide_multitap
  2086.  * DESCRIPTION
  2087.  *  Hide function for multitap
  2088.  *  
  2089.  *  Internal function
  2090.  * PARAMETERS
  2091.  *  void
  2092.  * RETURNS
  2093.  *  void
  2094.  *****************************************************************************/
  2095. static void category435_hide_multitap(void)
  2096. {
  2097.     /*----------------------------------------------------------------*/
  2098.     /* Local Variables                                                */
  2099.     /*----------------------------------------------------------------*/
  2100.     /*----------------------------------------------------------------*/
  2101.     /* Code Body                                                      */
  2102.     /*----------------------------------------------------------------*/
  2103.     /* We fill the multitap bar across the screen instead of using MMI_multitap_x & MMI_multitap_width */
  2104.     gui_lock_double_buffer();
  2105.     gui_reset_clip();
  2106.     /* HACK. IME might clear the background. We can not use MMI_multitap_x & MMI_multitap_width to erase background */
  2107.     gui_fill_rectangle(
  2108.         0,
  2109.         MMI_multitap_y,
  2110.         UI_device_width - 1,
  2111.         MMI_multitap_y + MMI_multitap_height - 1,
  2112.         g_mmi_gui_cat435_popup_color);
  2113.     gui_unlock_double_buffer();
  2114.     gui_BLT_double_buffer(0, MMI_multitap_y, UI_device_width - 1, MMI_multitap_y + MMI_multitap_height - 1);
  2115. }
  2116. /*****************************************************************************
  2117.  * FUNCTION
  2118.  *  category435_setup_log_box
  2119.  * DESCRIPTION
  2120.  *  
  2121.  * PARAMETERS
  2122.  *  log_buffer          [?]         
  2123.  *  log_buffer_size     [IN]        
  2124.  * RETURNS
  2125.  *  void
  2126.  *****************************************************************************/
  2127. static void category435_setup_log_box(U8 *log_buffer, S32 log_buffer_size)
  2128. {
  2129.     /*----------------------------------------------------------------*/
  2130.     /* Local Variables                                                */
  2131.     /*----------------------------------------------------------------*/
  2132.     /*
  2133.      * In Arabic, the ailgnment format is decided by the content of file. 
  2134.      * * MSN align chat log to left.
  2135.      */
  2136.     S32 log_length;
  2137.     multi_line_input_box *b = &CAT435_CTX->log_box;
  2138.     /*----------------------------------------------------------------*/
  2139.     /* Code Body                                                      */
  2140.     /*----------------------------------------------------------------*/
  2141.     log_length = gui_strlen((UI_string_type) log_buffer);
  2142.     gui_create_multi_line_input_box_set_buffer(
  2143.         b,
  2144.         MMI_CONTENT_X_WITH_H_TAB,
  2145.         MMI_CONTENT_Y_WITH_H_TAB,
  2146.         MMI_CONTENT_WIDTH_WITH_H_TAB,
  2147.         MMI_CONTENT_HEIGHT_WITH_H_TAB,
  2148.         (UI_string_type) log_buffer,
  2149.         log_buffer_size * 2,
  2150.         (log_length + 1) * 2,
  2151.         0);
  2152.     gui_move_multi_line_input_box(b, MMI_CONTENT_X_WITH_H_TAB, MMI_CONTENT_Y_WITH_H_TAB);
  2153.     gui_resize_multi_line_input_box(b, MMI_CONTENT_WIDTH_WITH_H_TAB, MMI_CONTENT_HEIGHT_WITH_H_TAB);
  2154.     b->flags |=
  2155.         (UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE |
  2156.          UI_MULTI_LINE_INPUT_BOX_RICHTEXT);
  2157. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  2158.     b->flags |= UI_MULTI_LINE_INPUT_BOX_TRANSPARENT_BACKGROUND;
  2159. #endif 
  2160.     b->icon_callback = CAT435_CTX->icon_callback;
  2161.     // b->min_line_height = (S16) CAT435_CTX->icon_height + 1; /* Editor has one more pixel between lines */
  2162.     // b->normal_filler = (UI_filled_area *)&g_mmi_gui_cat435_editor_filler;
  2163.     // TODO: combine the following two procedure in one function in gui_inputs.c
  2164.     /* Compute text height and adjust scroll offset */
  2165.     b->flags |= UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
  2166.     gui_show_multi_line_input_box(b);
  2167.     b->flags &= ~UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
  2168.     if (b->text_height > b->edit_height)
  2169.     {
  2170.         b->text_offset_y = -(b->text_height - b->edit_height);
  2171.     }
  2172. }
  2173. /*****************************************************************************
  2174.  * FUNCTION
  2175.  *  category435_log_box_previous_line
  2176.  * DESCRIPTION
  2177.  *  
  2178.  * PARAMETERS
  2179.  *  void
  2180.  * RETURNS
  2181.  *  void
  2182.  *****************************************************************************/
  2183. void category435_log_box_previous_line(void)
  2184. {
  2185.     /*----------------------------------------------------------------*/
  2186.     /* Local Variables                                                */
  2187.     /*----------------------------------------------------------------*/
  2188.     /*----------------------------------------------------------------*/
  2189.     /* Code Body                                                      */
  2190.     /*----------------------------------------------------------------*/
  2191.     gui_lock_double_buffer();
  2192.     gui_multi_line_input_box_previous_line(&CAT435_CTX->log_box);
  2193.     gui_show_multi_line_input_box(&CAT435_CTX->log_box);
  2194.     gui_unlock_double_buffer();
  2195.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  2196. }
  2197. /*****************************************************************************
  2198.  * FUNCTION
  2199.  *  category435_log_box_next_line
  2200.  * DESCRIPTION
  2201.  *  
  2202.  * PARAMETERS
  2203.  *  void
  2204.  * RETURNS
  2205.  *  void
  2206.  *****************************************************************************/
  2207. void category435_log_box_next_line(void)
  2208. {
  2209.     /*----------------------------------------------------------------*/
  2210.     /* Local Variables                                                */
  2211.     /*----------------------------------------------------------------*/
  2212.     /*----------------------------------------------------------------*/
  2213.     /* Code Body                                                      */
  2214.     /*----------------------------------------------------------------*/
  2215.     gui_lock_double_buffer();
  2216.     gui_multi_line_input_box_next_line(&CAT435_CTX->log_box);
  2217.     gui_show_multi_line_input_box(&CAT435_CTX->log_box);
  2218.     gui_unlock_double_buffer();
  2219.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  2220. }
  2221. #if defined(__MMI_TOUCH_SCREEN__)
  2222. /*****************************************************************************
  2223.  * FUNCTION
  2224.  *  cat435_virtual_keypad_callback
  2225.  * DESCRIPTION
  2226.  *  
  2227.  * PARAMETERS
  2228.  *  void
  2229.  * RETURNS
  2230.  *  void
  2231.  *****************************************************************************/
  2232. void cat435_virtual_keypad_callback(void)
  2233. {
  2234.     /*----------------------------------------------------------------*/
  2235.     /* Local Variables                                                */
  2236.     /*----------------------------------------------------------------*/
  2237.     /*----------------------------------------------------------------*/
  2238.     /* Code Body                                                      */
  2239.     /*----------------------------------------------------------------*/
  2240.     mmi_pen_editor_resize_multiline_input_box_for_vk();
  2241. }
  2242. #endif /* defined(__MMI_TOUCH_SCREEN__) */ 
  2243. /*****************************************************************************
  2244.  * FUNCTION
  2245.  *  category435_setup_editor_box
  2246.  * DESCRIPTION
  2247.  *  
  2248.  * PARAMETERS
  2249.  *  buffer              [?]         
  2250.  *  buffer_size         [IN]        
  2251.  *  input_type          [IN]        
  2252.  *  history_buffer      [?]         
  2253.  * RETURNS
  2254.  *  void
  2255.  *****************************************************************************/
  2256. static void category435_setup_editor_box(U8 *buffer, S32 buffer_size, S16 input_type, U8 *history_buffer)
  2257. {
  2258.     /*----------------------------------------------------------------*/
  2259.     /* Local Variables                                                */
  2260.     /*----------------------------------------------------------------*/
  2261.     S32 inputbox_x = CAT435_POPUP_X + CAT435_POPUP_H_GAP;
  2262.     S32 inputbox_y = CAT435_POPUP_Y + CAT435_POPUP_TITLE_HEIGHT;
  2263.     S32 inputbox_width = CAT435_POPUP_WIDTH - CAT435_POPUP_H_GAP * 2;
  2264.     S32 inputbox_height = CAT435_POPUP_HEIGHT - CAT435_POPUP_TITLE_HEIGHT - CAT435_POPUP_BOTTOM_GAP;
  2265.     /*----------------------------------------------------------------*/
  2266.     /* Code Body                                                      */
  2267.     /*----------------------------------------------------------------*/
  2268. #ifdef __MMI_T9__
  2269.     InuptMethodEnterCategory5();
  2270. #elif defined __MMI_ZI__
  2271.     ZiInuptMethodEnterCategory5();
  2272. //KP Jerry add on 2007-3-8 start
  2273. #elif defined __MMI_CSTAR__
  2274. CstarInputMethodEnterCategory5();
  2275. //KP Jerry add on 2007-3-8 end
  2276. #elif defined __MMI_KA__
  2277.     KonkaInuptMethodEnterCategory5();
  2278. #elif defined __MMI_ITAP__
  2279. /* under construction !*/
  2280. #endif 
  2281.     register_hide_multitap(category435_hide_multitap);
  2282.     /* Workaround. we need to set following variables */
  2283.     MMI_multiline_inputbox_width = inputbox_width;
  2284.     MMI_multiline_inputbox_height = inputbox_height;
  2285.     /* HACK. Arabic editor does not handle UI_MULTI_LINE_INPUT_BOX_AUTO_DISABLE_SCROLLBAR well */
  2286.     wgui_setup_inputbox_ext(
  2287.         inputbox_x,
  2288.         inputbox_y,
  2289.         inputbox_width,
  2290.         inputbox_height,
  2291.         buffer,
  2292.         buffer_size,
  2293.         MMI_CATEGORY435_ID,
  2294.         get_string(CAT435_CTX->editor_right_softkey),
  2295.         get_image(CAT435_CTX->editor_right_softkey_icon),
  2296.         input_type,
  2297.         history_buffer,
  2298.         1,
  2299.         r2lMMIFlag ? 0 : UI_MULTI_LINE_INPUT_BOX_AUTO_DISABLE_SCROLLBAR,
  2300.         0,
  2301.     #ifdef __MMI_T9__  /* T9 doesn't support icon in editor */
  2302.         0,
  2303.     #else
  2304.         (S16) (CAT435_CTX->icon_height + 1),
  2305.     #endif
  2306.         0,
  2307.         0,
  2308.     #ifdef __MMI_T9__
  2309.         NULL
  2310.     #else
  2311.         CAT435_CTX->icon_callback
  2312.     #endif
  2313.         );
  2314.     /* Resize editor height */
  2315. #if defined(__MMI_FULL_SCREEN_EDITOR__)
  2316.     inputbox_height =
  2317.         CAT435_POPUP_HEIGHT - CAT435_POPUP_TITLE_HEIGHT - CAT435_POPUP_BOTTOM_GAP -
  2318.         wgui_inputbox_information_bar_height - 1;
  2319. #else /* defined(__MMI_FULL_SCREEN_EDITOR__) */ 
  2320.     inputbox_height =
  2321.         CAT435_POPUP_HEIGHT - CAT435_POPUP_TITLE_HEIGHT - CAT435_POPUP_BOTTOM_GAP - MMI_multitap_height -
  2322.         wgui_inputbox_information_bar_height - 1;
  2323. #endif /* defined(__MMI_FULL_SCREEN_EDITOR__) */ 
  2324.     resize_multiline_inputbox(inputbox_width, inputbox_height);
  2325.     show_multiline_inputbox_no_draw();  /* recompute cursor position */
  2326.     /* Override editor style */
  2327.     MMI_multiline_inputbox.normal_filler = (UI_filled_area*)&g_mmi_gui_cat435_editor_filler;
  2328. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  2329.     MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_TRANSPARENT_BACKGROUND;
  2330. #endif 
  2331.     /* Key handler (category435_reset_editor_box reset wgui_inputbox_RSK_function) */
  2332.     wgui_inputbox_RSK_function = CAT435_CTX->editor_RSK_func;
  2333.     SetLeftSoftkeyFunction(CAT435_CTX->editor_LSK_func, KEY_EVENT_UP);
  2334.     /* Virtual keyboard */
  2335. #ifdef __MMI_TOUCH_SCREEN__
  2336.     dm_register_vkpad_callback(cat435_virtual_keypad_callback);
  2337. #endif 
  2338.     /* For draw manager, wgui_setup_inputbox_ext and wgui_close_inputbox should be paired. */
  2339.     MMI_DBG_ASSERT(!CAT435_CTX->editor_created);
  2340.     CAT435_CTX->editor_created = 1;
  2341. }
  2342. /*****************************************************************************
  2343.  * FUNCTION
  2344.  *  category435_reset_editor_box
  2345.  * DESCRIPTION
  2346.  *  
  2347.  * PARAMETERS
  2348.  *  void
  2349.  * RETURNS
  2350.  *  void
  2351.  *****************************************************************************/
  2352. static void category435_reset_editor_box(void)
  2353. {
  2354.     /*----------------------------------------------------------------*/
  2355.     /* Local Variables                                                */
  2356.     /*----------------------------------------------------------------*/
  2357.     /*----------------------------------------------------------------*/
  2358.     /* Code Body                                                      */
  2359.     /*----------------------------------------------------------------*/
  2360.     gui_lock_double_buffer();
  2361.     /* Virtual keyboard */
  2362. #ifdef __MMI_TOUCH_SCREEN__
  2363.     dm_register_vkpad_callback(NULL);
  2364. #endif 
  2365.     wgui_close_inputbox();
  2366.     reset_multitaps();
  2367.     gui_unlock_double_buffer();
  2368.     CAT435_CTX->editor_created = 0;
  2369. }
  2370. /* We need to sync with T9 internal state */
  2371. /*****************************************************************************
  2372.  * FUNCTION
  2373.  *  category435_sync_with_T9
  2374.  * DESCRIPTION
  2375.  *  
  2376.  * PARAMETERS
  2377.  *  void
  2378.  * RETURNS
  2379.  *  void
  2380.  *****************************************************************************/
  2381. static void category435_sync_with_T9(void)
  2382. {
  2383. #ifdef __MMI_T9__
  2384.     /*----------------------------------------------------------------*/
  2385.     /* Local Variables                                                */
  2386.     /*----------------------------------------------------------------*/
  2387.     /*----------------------------------------------------------------*/
  2388.     /* Code Body                                                      */
  2389.     /*----------------------------------------------------------------*/
  2390.     switch (MMI_current_input_type & INPUT_TYPE_MASK)
  2391.     {
  2392.         case INPUT_TYPE_TR_BOPOMO:
  2393.         case INPUT_TYPE_SM_PINYIN:
  2394.         case INPUT_TYPE_TR_STROKE:
  2395.         case INPUT_TYPE_SM_STROKE:
  2396.         case INPUT_TYPE_SMART_UPPERCASE_ABC:
  2397.         case INPUT_TYPE_SMART_LOWERCASE_ABC:
  2398.         case INPUT_TYPE_TR_MULTITAP_BOPOMO:
  2399.         case INPUT_TYPE_SM_MULTITAP_PINYIN:
  2400.     #if defined(__MMI_T9_SPANISH__)
  2401.         case INPUT_TYPE_SMART_UPPERCASE_SPANISH:
  2402.         case INPUT_TYPE_SMART_LOWERCASE_SPANISH:
  2403.     #endif /* defined(__MMI_T9_SPANISH__) */ 
  2404.             /* PMT VIKASG START 20050729 */
  2405.     #if defined(__MMI_T9_DANISH__)
  2406.         case INPUT_TYPE_SMART_UPPERCASE_DANISH:
  2407.         case INPUT_TYPE_SMART_LOWERCASE_DANISH:
  2408.     #endif /* defined(__MMI_T9_DANISH__) */ 
  2409.             //PMT VIKASG END 20050729
  2410.             //PMT CZ_PO_TU START 20050812