wgui_categories_imps.c

来自「The font library converting tool MCT mai」· C语言 代码 · 共 1,967 行 · 第 1/5 页

C
1,967
字号
	pixtel_UI_set_text_color(pixtel_UI_color(CAT430_NAME2_COLOR_R, CAT430_NAME2_COLOR_G, CAT430_NAME2_COLOR_B));
	pixtel_UI_print_text((UI_string_type)CAT430_CTX->name2);
#endif /* ~ CAT430_NAME_IN_LOG  */

	pixtel_UI_show_multi_line_input_box(&CAT430_CTX->log_box1);
	pixtel_UI_show_multi_line_input_box(&MMI_multiline_inputbox);
}

void category430_previous_line(void)
{
	pixtel_UI_lock_double_buffer();
	pixtel_UI_multi_line_input_box_previous_line(&CAT430_CTX->log_box1);
	pixtel_UI_show_multi_line_input_box(&CAT430_CTX->log_box1);
	pixtel_UI_multi_line_input_box_previous_line(&MMI_multiline_inputbox);
	pixtel_UI_show_multi_line_input_box(&MMI_multiline_inputbox);
	pixtel_UI_unlock_double_buffer();
	pixtel_UI_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
}

void category430_next_line(void)
{
	pixtel_UI_lock_double_buffer();
	pixtel_UI_multi_line_input_box_next_line(&CAT430_CTX->log_box1);
	pixtel_UI_show_multi_line_input_box(&CAT430_CTX->log_box1);
	pixtel_UI_multi_line_input_box_next_line(&MMI_multiline_inputbox);
	pixtel_UI_show_multi_line_input_box(&MMI_multiline_inputbox);
	pixtel_UI_unlock_double_buffer();
	pixtel_UI_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
}


void category430_draw_controlled_area(dm_coordinates *coordinate)
{
	category430_draw_content_area();
}

#ifdef __MMI_TOUCH_SCREEN__

static MMI_BOOL category430_control_area_pen_handler(mmi_pen_point_struct point, mmi_pen_event_type_enum pen_event)
{
	mmi_gui_multi_line_input_box_pen_enum event;
	
	if (!CAT430_CTX)
	{
		MMI_DBG_ASSERT(0);
		return MMI_FALSE;
	}

	if (pen_event == MMI_PEN_EVENT_DOWN)
	{
		CAT430_CTX->pen_object = 0;
		
		if (pixtel_UI_multi_line_input_box_translate_pen_event(&CAT430_CTX->log_box1, pen_event, point.x, point.y, &event))
		{
			CAT430_CTX->pen_object = 1;
			return MMI_TRUE;
		}
		if (pixtel_UI_multi_line_input_box_translate_pen_event(&MMI_multiline_inputbox, pen_event, point.x, point.y, &event))
		{
			CAT430_CTX->pen_object = 2;
			return MMI_TRUE;
		}
		else
		{
			return MMI_FALSE;
		} 
	}
	else
	{
		switch (CAT430_CTX->pen_object)
		{
			case 1:
				return pixtel_UI_multi_line_input_box_translate_pen_event(&CAT430_CTX->log_box1, pen_event, point.x, point.y, &event);
			case 2:
				return pixtel_UI_multi_line_input_box_translate_pen_event(&MMI_multiline_inputbox, pen_event, point.x, point.y, &event);
			default:
				return MMI_TRUE;
		}
	} 
}

static MMI_BOOL category430_control_area_pen_down_handler(mmi_pen_point_struct point)
{
	return category430_control_area_pen_handler(point, MMI_PEN_EVENT_DOWN);
}

static MMI_BOOL category430_control_area_pen_move_handler(mmi_pen_point_struct point)
{
	return category430_control_area_pen_handler(point, MMI_PEN_EVENT_MOVE);
}

static MMI_BOOL category430_control_area_pen_longtap_handler(mmi_pen_point_struct point)
{
	return category430_control_area_pen_handler(point, MMI_PEN_EVENT_LONG_TAP);
}

static MMI_BOOL category430_control_area_pen_repeat_handler(mmi_pen_point_struct point)
{
	return category430_control_area_pen_handler(point, MMI_PEN_EVENT_REPEAT);
}

static MMI_BOOL category430_control_area_pen_up_handler(mmi_pen_point_struct point)
{
	return category430_control_area_pen_handler(point, MMI_PEN_EVENT_UP);
}

static MMI_BOOL category430_control_area_pen_abort_handler(mmi_pen_point_struct point)
{
	return category430_control_area_pen_handler(point, MMI_PEN_EVENT_ABORT);
}

#endif /* __MMI_TOUCH_SCREEN__ */



/* 
 * Category 435
 */

/*----------------------------------------------------------------------------
Function:				category435_hide_multitap
Description:			Hide function for multitap
Input Parameters:		none
Output Parameters:	none
Returns:					void
Remarks:					Internal function
----------------------------------------------------------------------------*/
static void category435_hide_multitap(void)
{
	/* We fill the multitap bar across the screen instead of using MMI_multitap_x & MMI_multitap_width*/
	pixtel_UI_lock_double_buffer();
	pixtel_UI_reset_clip();
	/* HACK. IME might clear the background. We can not use MMI_multitap_x & MMI_multitap_width to erase background */
	pixtel_UI_fill_rectangle( 0, MMI_multitap_y, UI_device_width - 1, MMI_multitap_y + MMI_multitap_height - 1, g_mmi_gui_cat435_popup_color);
	pixtel_UI_unlock_double_buffer();
	pixtel_UI_BLT_double_buffer(0, MMI_multitap_y, UI_device_width - 1, MMI_multitap_y + MMI_multitap_height - 1);
}


static void category435_setup_log_box(U8 *log_buffer, S32 log_buffer_size)
{
	/* In Arabic, the ailgnment format is decided by the content of file. 
	 * MSN align chat log to left.
	 */
	S32 log_length;
	multi_line_input_box *b = &CAT435_CTX->log_box;

	log_length=pixtel_UI_strlen((UI_string_type) log_buffer);
	pixtel_UI_create_multi_line_input_box_set_buffer(b, 
				MMI_CONTENT_X_WITH_H_TAB, MMI_CONTENT_Y_WITH_H_TAB,
				MMI_CONTENT_WIDTH_WITH_H_TAB, MMI_CONTENT_HEIGHT_WITH_H_TAB,
				(UI_string_type) log_buffer, log_buffer_size * 2, (log_length + 1)*2, 0);
	pixtel_UI_move_multi_line_input_box(b, MMI_CONTENT_X_WITH_H_TAB, MMI_CONTENT_Y_WITH_H_TAB);
	pixtel_UI_resize_multi_line_input_box(b, MMI_CONTENT_WIDTH_WITH_H_TAB, MMI_CONTENT_HEIGHT_WITH_H_TAB);

	b->flags|=(UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW|UI_MULTI_LINE_INPUT_BOX_VIEW_MODE|UI_MULTI_LINE_INPUT_BOX_RICHTEXT);
#ifdef __MMI_WALLPAPER_ON_BOTTOM__
	b->flags|=UI_MULTI_LINE_INPUT_BOX_TRANSPARENT_BACKGROUND;
#endif	
	b->icon_callback = CAT435_CTX->icon_callback;
	// b->min_line_height = (S16) CAT435_CTX->icon_height + 1; /* Editor has one more pixel between lines */
	// b->normal_filler = (UI_filled_area *)&g_mmi_gui_cat435_editor_filler;

	// TODO: combine the following two procedure in one function in gui_inputs.c
	/* Compute text height and adjust scroll offset */
	b->flags|=UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
	pixtel_UI_show_multi_line_input_box(b);
	b->flags&=~UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
	if (b->text_height > b->edit_height)
	{
		b->text_offset_y = -(b->text_height - b->edit_height);
	}
}


void category435_log_box_previous_line(void)
{
	pixtel_UI_lock_double_buffer();
	pixtel_UI_multi_line_input_box_previous_line(&CAT435_CTX->log_box);
	pixtel_UI_show_multi_line_input_box(&CAT435_CTX->log_box);
	pixtel_UI_unlock_double_buffer();
	pixtel_UI_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);	
}

void category435_log_box_next_line(void)
{
	pixtel_UI_lock_double_buffer();
	pixtel_UI_multi_line_input_box_next_line(&CAT435_CTX->log_box);
	pixtel_UI_show_multi_line_input_box(&CAT435_CTX->log_box);
	pixtel_UI_unlock_double_buffer();
	pixtel_UI_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);	
}

#if defined(__MMI_TOUCH_SCREEN__)
void cat435_virtual_keypad_callback(void)
{
   mmi_pen_editor_resize_multiline_input_box_for_vk();
}
#endif /* __MMI_TOUCH_SCREEN__ */

static void category435_setup_editor_box(U8* buffer, S32 buffer_size, S16 input_type, U8 *history_buffer)
{
	s32 inputbox_x = CAT435_POPUP_X + CAT435_POPUP_H_GAP;
	s32 inputbox_y = CAT435_POPUP_Y + CAT435_POPUP_TITLE_HEIGHT;
	s32 inputbox_width = CAT435_POPUP_WIDTH - CAT435_POPUP_H_GAP * 2;
	s32 inputbox_height = CAT435_POPUP_HEIGHT -CAT435_POPUP_TITLE_HEIGHT - CAT435_POPUP_BOTTOM_GAP;

#ifdef __MMI_T9__
	InuptMethodEnterCategory5();
#elif defined __MMI_ZI__
	ZiInuptMethodEnterCategory5();
#elif defined __MMI_KA__
	KonkaInuptMethodEnterCategory5();
#elif defined __MMI_ITAP__
	ItapInuptMethodEnterCategory5();
#elif defined(__MMI_GB__) //InuptMethodEnterCategory5(void);
    GBInputMethodEnterCategory5();

#endif

	register_hide_multitap(category435_hide_multitap);

	/* Workaround. we need to set following variables */
	MMI_multiline_inputbox_width = inputbox_width;
	MMI_multiline_inputbox_height =inputbox_height;

	/* HACK. Arabic editor does not handle UI_MULTI_LINE_INPUT_BOX_AUTO_DISABLE_SCROLLBAR well */
#ifdef __MMI_T9__  /* T9 doesn't support icon in editor */
	wgui_setup_inputbox_ext(inputbox_x, inputbox_y, inputbox_width, inputbox_height,
			buffer, buffer_size, MMI_CATEGORY435_ID, 
			get_string(CAT435_CTX->editor_right_softkey), get_image(CAT435_CTX->editor_right_softkey_icon),
			input_type, history_buffer, 1, 
			r2lMMIFlag ? 0 : UI_MULTI_LINE_INPUT_BOX_AUTO_DISABLE_SCROLLBAR, 0, 0, 0, 0, NULL);
#else
	wgui_setup_inputbox_ext(inputbox_x, inputbox_y, inputbox_width, inputbox_height,
			buffer, buffer_size, MMI_CATEGORY435_ID, 
			get_string(CAT435_CTX->editor_right_softkey), get_image(CAT435_CTX->editor_right_softkey_icon),
			input_type, history_buffer, 1, 
			r2lMMIFlag ? 0 : UI_MULTI_LINE_INPUT_BOX_AUTO_DISABLE_SCROLLBAR, 0, (S16) (CAT435_CTX->icon_height + 1), 0, 0, CAT435_CTX->icon_callback);
#endif

	/* Resize editor height */
#if defined(__MMI_FULL_SCREEN_EDITOR__)
	inputbox_height = CAT435_POPUP_HEIGHT -CAT435_POPUP_TITLE_HEIGHT - CAT435_POPUP_BOTTOM_GAP - wgui_inputbox_information_bar_height - 1;
#else
	inputbox_height = CAT435_POPUP_HEIGHT -CAT435_POPUP_TITLE_HEIGHT - CAT435_POPUP_BOTTOM_GAP -MMI_multitap_height - wgui_inputbox_information_bar_height - 1;
#endif
	resize_multiline_inputbox(inputbox_width, inputbox_height);
	show_multiline_inputbox_no_draw(); /* recompute cursor position */

	/* Override editor style */
	MMI_multiline_inputbox.normal_filler = (UI_filled_area *)&g_mmi_gui_cat435_editor_filler;

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

	/* Key handler (category435_reset_editor_box reset wgui_inputbox_RSK_function) */
	wgui_inputbox_RSK_function = CAT435_CTX->editor_RSK_func;
	SetLeftSoftkeyFunction(CAT435_CTX->editor_LSK_func, KEY_EVENT_UP);	

	/* Virtual keyboard */
#ifdef __MMI_TOUCH_SCREEN__
	dm_register_vkpad_callback(cat435_virtual_keypad_callback);
#endif

	/* For draw manager, wgui_setup_inputbox_ext and wgui_close_inputbox should be paired. */ 
	MMI_DBG_ASSERT(!CAT435_CTX->editor_created);
	CAT435_CTX->editor_created = 1;
}


static void category435_reset_editor_box(void)
{
	pixtel_UI_lock_double_buffer();
	/* Virtual keyboard */
#ifdef __MMI_TOUCH_SCREEN__
	dm_register_vkpad_callback(NULL);
#endif
	wgui_close_inputbox();
	reset_multitaps();
	pixtel_UI_unlock_double_buffer();

	CAT435_CTX->editor_created = 0;	
}


/* We need to sync with T9 internal state */
static void category435_sync_with_T9(void)
{
#ifdef __MMI_T9__
	switch(MMI_current_input_type & INPUT_TYPE_MASK)
	{
     case INPUT_TYPE_TR_BOPOMO:
     case INPUT_TYPE_SM_PINYIN:
     case INPUT_TYPE_TR_STROKE:
     case INPUT_TYPE_SM_STROKE:
     case INPUT_TYPE_SMART_UPPERCASE_ABC:
     case INPUT_TYPE_SMART_LOWERCASE_ABC:
     case INPUT_TYPE_SMART_UPPERCASE_GERMAN:
     case INPUT_TYPE_SMART_LOWERCASE_GERMAN:
     case INPUT_TYPE_TR_MULTITAP_BOPOMO:
     case INPUT_TYPE_SM_MULTITAP_PINYIN:

#if defined(__MMI_T9_SPANISH__)
     case INPUT_TYPE_SMART_UPPERCASE_SPANISH:
     case INPUT_TYPE_SMART_LOWERCASE_SPANISH:
#endif
//PMT VIKASG START 20050729
#if defined(__MMI_T9_DANISH__)
     case INPUT_TYPE_SMART_UPPERCASE_DANISH:
     case INPUT_TYPE_SMART_LOWERCASE_DANISH:
#endif
//PMT VIKASG END 20050729
//PMT CZ_PO_TU START 20050812  
#if defined(__MMI_T9_POLISH__)
     case INPUT_TYPE_SMART_UPPERCASE_POLISH:
     case INPUT_TYPE_SMART_LOWERCASE_POLISH:
#endif
//PMT CZ_PO_TU END 20050812  
#if defined(__MMI_T9_FRENCH__)
     case INPUT_TYPE_SMART_UPPERCASE_FRENCH:
     case INPUT_TYPE_SMART_LOWERCASE_FRENCH:
#endif
#if defined(__MMI_T9_GERMAN__)
     case INPUT_TYPE_SMART_UPPERCASE_GERMAN:
     case INPUT_TYPE_SMART_LOWERCASE_GERMAN:
#endif
#if defined(__MMI_T9_ITALIAN__)
     case INPUT_TYPE_SMART_UPPERCASE_ITALIAN:
     case INPUT_TYPE_SMART_LOWERCASE_ITALIAN:
#endif
//PMT Gurdev Start 20050729
#if defined(__MMI_T9_INDONESIAN__)
     case INPUT_TYPE_SMART_UPPERCASE_INDONESIAN:
     case INPUT_TYPE_SMART_LOWERCASE_INDONESIAN:
#endif
//PMT Gurdev End 20050729
//PMT SHARIQ START 20050729
#if defined(__MMI_T9_PORTUGUESE__)
	case INPUT_TYPE_SMART_UPPERCASE_PORTUGUESE:
	case INPUT_TYPE_SMART_LOWERCASE_PORTUGUESE:
#endif
//PMT SHARIQ END 20050729
// PMT BHASKAR START 20052907

#if defined(__MMI_T9_VIETNAMESE__)
     case INPUT_TYPE_SMART_UPPERCASE_VIETNAMESE:
     case INPUT_TYPE_SMART_LOWERCASE_VIETNAMESE:
#endif

// PMT BHASKAR END 20052907
//PMT CZ_PO_TU START 20050812
#if defined(__MMI_T9_CZECH__)
     case INPUT_TYPE_SMART_UPPERCASE_CZECH:
     case INPUT_TYPE_SMART_LOWERCASE_CZECH:
#endif
//PMT CZ_PO_TU END 20050812  
//PMT CZ_PO_TU START 20050812
#if defined(__MMI_T9_TURKISH__)
     case INPUT_TYPE_SMART_UPPERCASE_TURKISH:
     case INPUT_TYPE_SMART_LOWERCASE_TURKISH:
#endif
//PMT CZ_PO_TU END 20050812  
//PMT START HU_FI 20050825
#if defined(__MMI_T9_FINNISH__)
     case INPUT_TYPE_SMART_UPPERCASE_FINNISH:
     case INPUT_TYPE_SMART_LOWERCASE_FINNISH:
#endif
#if defined(__MMI_T9_HUNGARIAN__)
     case INPUT_TYPE_SMART_UPPERCASE_HUNGARIAN:
     case INPUT_TYPE_SMART_LOWERCASE_HUNGARIAN:
#endif
//PMT END HU_FI 20050825
//PMT NO_AR_SL_DU START 20050909
#if defined(__MMI_T9_ARABIC__)
     case INPUT_TYPE_SMART_ARABIC:
#endif
//PMT VIKAS GUPTA START 20051129
#if defined(__MMI_T9_HINDI__)
     case INPUT_TYPE_SMART_HINDI:
#endif
//PMT VIKAS GUPTA END 20051129
//Norwegian start
#if defined(__MMI_T9_NORWEGIAN__)
     case INPUT_TYPE_SMART_UPPERCASE_NORWEGIAN:
     case INPUT_TYPE_SMART_LOWERCASE_NORWEGIAN:
#endif
//Norwegian end
//START DUTCH_T9 20051021
#if defined(__MM

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?