⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wgui_inline_edit.c

📁 The font library converting tool MCT mainly introduces the process of the font formats to give us a
💻 C
📖 第 1 页 / 共 5 页
字号:
/* under construction !*/
/* under construction !*/
#endif
/* under construction !*/
/* under construction !*/
#endif
//PMT VIKAS END 20050630


//Function Added To Get The Status Of Inline Screen - Gurinder 15/4/2004
S32 get_wgui_inline_list_menu_status(void)
{
	return wgui_inline_list_menu_changed;
}

void set_wgui_inline_list_menu_status(S32 status)
{
	wgui_inline_list_menu_changed = (byte) status;
}

/*** Image Text Control *****/
#if defined __MMI_PLUTO_GPRS__
void ShowAsControl(InlineItem * item)
{
	item->show_img_flag = TRUE;
}


void SetInlineFullScreenEditCustomFunctionImageText(InlineItem * item, void (*f) (void))
{
	wgui_inline_image_text *image_item = (wgui_inline_image_text *) item->item;
	wgui_inline_item_text_edit *i = (wgui_inline_item_text_edit *) image_item->inline_full_text;

	i->custom_setup_function = f;
}

void UI_dummy_edit_complete_handler(U8 * buffer, S32 buffer_size)
{
	UI_UNUSED_PARAMETER(buffer);
	UI_UNUSED_PARAMETER(buffer_size);
}


#ifdef __MMI_TOUCH_SCREEN__

void inline_image_text_redraw_image_by_pen(wgui_inline_image_text * i)
{
	S32 index = i->pen_down_image_index;
	UI_image_type image = NULL;			 //111605 warning Calvin
	S32 image_y_offset = 0;
	S32 x1, y1, x2, y2;

	if (index < 0)
		return;

	gdi_layer_push_clip();
	gdi_layer_reset_clip();
	gdi_layer_lock_frame_buffer();

	x1 = i->image_left_top[index].x;
	y1 = i->image_left_top[index].y;
	x2 = i->image_right_bottom[index].x;
	y2 = i->image_right_bottom[index].y;

	pixtel_UI_draw_filled_area(x1, y1, x2, y2 + 1, wgui_inline_select_fixed_text_menuitem_theme.selected_filler);

	if (index == i->pen_curr_pressed_image_index)
		image_y_offset++;

	if (index == 0)
		image = i->image2;
	else if (index == 1)
		image = i->image3;
	else
		MMI_ASSERT(0);

	pixtel_UI_show_transparent_image(x1, y1 + image_y_offset, image, 0);

	pixtel_UI_pop_clip();

	gdi_layer_unlock_frame_buffer();
	gdi_layer_blt_previous(x1, y1, x2, y2 + 1);
}

BOOL inline_image_text_pen_handler(mmi_pen_event_type_enum pen_event, S16 x, S16 y,
											  mmi_gui_inline_item_pen_enum * item_event)
{
	BOOL ret = MMI_TRUE;
	wgui_inline_image_text *i = current_image_text_control;

	*item_event = GUI_INLINE_ITEM_PEN_NONE;

	if (!i)
	{
		MMI_DBG_ASSERT(0);
		return MMI_FALSE;
	}

	switch (pen_event)
	{
		case MMI_PEN_EVENT_DOWN:
			i->pen_down_image_index = -1;
			if (i->image2 && i->image_callback[0] && x >= i->image_left_top[0].x && y >= i->image_left_top[0].y &&
				 x <= i->image_right_bottom[0].x && y <= i->image_right_bottom[0].y)
			{
				i->pen_down_image_index = 0;
				i->pen_curr_pressed_image_index = 0;
				inline_image_text_redraw_image_by_pen(i);
			}
			else if (i->image3 && i->image_callback[1] && x >= i->image_left_top[1].x && y >= i->image_left_top[1].y &&
						x <= i->image_right_bottom[1].x && y <= i->image_right_bottom[1].y)
			{
				i->pen_down_image_index = 1;
				i->pen_curr_pressed_image_index = 1;
				inline_image_text_redraw_image_by_pen(i);
			}
			else
			{
				ret = MMI_FALSE;
			}
			break;

		case MMI_PEN_EVENT_MOVE:
			if (i->pen_down_image_index >= 0)
			{
				S32 index = i->pen_down_image_index;

				if (i->pen_curr_pressed_image_index == i->pen_down_image_index)
				{
					if (!(x >= i->image_left_top[index].x && y >= i->image_left_top[index].y &&
							x <= i->image_right_bottom[index].x && y <= i->image_right_bottom[index].y))
					{
						i->pen_curr_pressed_image_index = -1;
						inline_image_text_redraw_image_by_pen(i);
					}
				}
				else
				{
					if (x >= i->image_left_top[index].x && y >= i->image_left_top[index].y &&
						 x <= i->image_right_bottom[index].x && y <= i->image_right_bottom[index].y)
					{
						i->pen_curr_pressed_image_index = index;
						inline_image_text_redraw_image_by_pen(i);
					}
				}
			}
			break;

		case MMI_PEN_EVENT_UP:
			if (i->pen_down_image_index >= 0 && i->pen_curr_pressed_image_index >= 0)
			{
				i->pen_curr_pressed_image_index = -1;
				inline_image_text_redraw_image_by_pen(i);

				if (i->image_callback[i->pen_down_image_index])
				{
					(i->image_callback[i->pen_down_image_index]) ();
				}
			}
			break;

		case MMI_PEN_EVENT_ABORT:
			if (i->pen_down_image_index >= 0 && i->pen_curr_pressed_image_index >= 0)
			{
				i->pen_curr_pressed_image_index = -1;
				inline_image_text_redraw_image_by_pen(i);
			}
			break;

	}

	return ret;
}

#endif /* __MMI_TOUCH_SCREEN__ */


void SetInlineItemImageText(InlineItem * item, U8 * text, UI_image_type image1, UI_image_type image2,
									 UI_image_type image3, S32 buf_size, U16 title, U16 title_icon, S16 input_type)
{
	wgui_inline_image_text *image_item;
	wgui_inline_item_text_edit *i;
	UI_buffer_type mask_buffer;
	S16 t = input_type & INPUT_TYPE_MASK;

	if (n_inline_image_text >= MAX_INLINE_IMAGE_TEXT_ITEMS)
		return;
	if (n_inline_text_edit_items >= MAX_INLINE_TEXT_EDIT_ITEMS)
		return;

	item->item = (void *)&wgui_inline_image_text_items[n_inline_image_text];
	item->flags = INLINE_ITEM_IMAGE_TEXT_TYPE;
	item->show_img_flag = FALSE;
	n_inline_image_text++;
	image_item = (wgui_inline_image_text *) item->item;
	image_item->flags = 0;
	image_item->buffer_size = buf_size;
	image_item->image1 = image1;
	image_item->image2 = image2;
	image_item->image3 = image3;
	image_item->text = text;
	item->handler = handle_inline_full_screen_imagetext_edit;	//wpixtel_UI_show_image_text_item;//handle_inline_full_screen_imagetext_edit ;
#ifdef __MMI_TOUCH_SCREEN__
	memset(image_item->image_callback, 0, sizeof(image_item->image_callback));
	memset(image_item->image_left_top, 0, sizeof(image_item->image_left_top));
	memset(image_item->image_right_bottom, 0, sizeof(image_item->image_right_bottom));
	image_item->pen_down_image_index = -1;
	image_item->pen_curr_pressed_image_index = -1;
#endif /* __MMI_TOUCH_SCREEN__ */

	image_item->inline_full_text = (void *)&wgui_inline_text_edit_items[n_inline_text_edit_items];
	mask_buffer = inline_text_edit_mask_buffers[n_inline_text_edit_items];
	n_inline_text_edit_items++;
	i = (wgui_inline_item_text_edit *) image_item->inline_full_text;
	i->title = title;
	i->title_icon = title_icon;
	i->buffer = text;
	i->buffer_size = buf_size;
	i->flags = 0;
	i->input_type = input_type;
	item->text_p = i->buffer;
	i->edit_complete_callback = UI_dummy_edit_complete_handler;
	i->custom_setup_function = NULL;
	i->validation_callback = UI_dummy_validation_function;
	if ((t == INPUT_TYPE_NUMERIC_PASSWORD) || (t == INPUT_TYPE_ALPHANUMERIC_PASSWORD) ||
		 (t == INPUT_TYPE_SAT_NUMERIC_PASSWORD))
	{
		inline_edit_prepare_mask_buffer(text, mask_buffer);
		i->mask_buffer = mask_buffer;
		item->text_p = mask_buffer;
	}
	/* UCS2_count==-1 means this field hasn't been edited */
	i->UCS2_count = -1;



}


#ifdef __MMI_TOUCH_SCREEN__
void SetInlineImageTextPenHandler(InlineItem * item, FuncPtr image2_callback, FuncPtr image3_callback)
{
	wgui_inline_image_text *image_item = (wgui_inline_image_text *) item->item;

	image_item->image_callback[0] = image2_callback;
	image_item->image_callback[1] = image3_callback;
}
#endif /* __MMI_TOUCH_SCREEN__ */


void wgui_inlinescrolling_timer(void)
{
	pixtel_UI_handle_scrolling_text(&wgui_inline_scroll_text);
	if (inline_last_image)
		pixtel_UI_show_transparent_image(103, inline_y_pos_image, inline_last_image, 0);
}

void wgui_scrolling_text_draw_background(S32 x1, S32 y1, S32 x2, S32 y2)
{
	pixtel_UI_draw_filled_area(x1, y1, x2, y2, (wgui_inline_select_fixed_text_menuitem_theme.selected_filler));
}

void wpixtel_UI_show_image_text_control(wgui_inline_image_text * i)
{
	//S32 y1 = i->y ;
	//S32 height = 0;
	wgui_inline_item_text_edit *i_edit = (wgui_inline_item_text_edit *) i->inline_full_text;

	draw_image_text_control(i, i->x, i->y, i->width, i->height, i->image1, i->image2, i->image3, i_edit->buffer, 1);


}

void redraw_image_text_control(void)
{
	gdi_layer_lock_frame_buffer();
	wpixtel_UI_show_image_text_control(current_image_text_control);
	gdi_layer_unlock_frame_buffer();
	gdi_layer_blt_previous(current_image_text_control->x, current_image_text_control->y,
										 current_image_text_control->x + current_image_text_control->width - 1,
										 current_image_text_control->y + current_image_text_control->height - 1);
}


void draw_image_text_control(wgui_inline_image_text * control, S32 x1, S32 y1, S32 iwidth, S32 iheight,
									  UI_image_type image1, UI_image_type image2, UI_image_type image3, U8 * text,
									  U8 highlight_flag)
{
	S32 width = 0, height = 0, char_height = 0, img_y1 = 0, text_y;
	color text_colr = pixtel_UI_color(0, 0, 0);
	S32 temp_x = x1 + 1;
	S32 text_x = 0, text_width = 0, text_height = 0;

	gdi_layer_push_clip();
	gdi_layer_reset_clip();
	pixtel_UI_reset_text_clip();

	//MTK Elvis for R2L characters
	if (!r2lMMIFlag)
	{
		if (image1)
		{
			pixtel_UI_measure_image((UI_image_type) image1, &width, &height);
			img_y1 = (MMI_INLINE_EDIT_MENUITEM_HEIGHT >> 1) - (height >> 1);
			pixtel_UI_show_transparent_image(temp_x, (y1 + img_y1), image1, 0);
			temp_x = x1 + width + 4;
		}
		else
			//20051012 HIMANSHU START INLINE SELECT
#ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
		if (!IsInlineItemDefaultTextEnable())
#endif
			//20051012 HIMANSHU END INLINE SELECT
			temp_x = x1 + MMI_fixed_icontext_menuitem.text_x;
		if (image2)
		{
			pixtel_UI_measure_image(image2, &width, &height);
			img_y1 = (MMI_INLINE_EDIT_MENUITEM_HEIGHT >> 1) - (height >> 1);
			pixtel_UI_show_transparent_image(temp_x, (y1 + img_y1), image2, 0);
			text_x = temp_x + width + 2;
			text_width = iwidth - text_x;
#ifdef __MMI_TOUCH_SCREEN__
			if (control)
			{
				control->image_left_top[0].x = temp_x;
				control->image_left_top[0].y = y1 + img_y1;
				control->image_right_bottom[0].x = temp_x + width - 1;
				control->image_right_bottom[0].y = y1 + img_y1 + height - 1;
			}
#endif
		}
		else
		{
			text_x = temp_x;
			text_width = iwidth - text_x - x1 - 4;
		}
		if (image3)
		{
			pixtel_UI_measure_image(image3, &width, &height);
			temp_x = x1 + 1 + iwidth - width - 2;
			img_y1 = (MMI_INLINE_EDIT_MENUITEM_HEIGHT >> 1) - (height >> 1);
			pixtel_UI_show_transparent_image(temp_x, (y1 + img_y1), image3, 0);
			text_width = temp_x - text_x - 2;
#ifdef __MMI_TOUCH_SCREEN__
			if (control)
			{
				control->image_left_top[1].x = temp_x;
				control->image_left_top[1].y = y1 + img_y1;
				control->image_right_bottom[1].x = temp_x + width - 1;
				control->image_right_bottom[1].y = y1 + img_y1 + height - 1;
			}
#endif
		}

	}
	else
	{
		temp_x = UI_device_width - 1;
		if (image1)
		{
			pixtel_UI_measure_image((UI_image_type) image1, &width, &height);
			img_y1 = (MMI_INLINE_EDIT_MENUITEM_HEIGHT >> 1) - (height >> 1);
			temp_x -= width;
			pixtel_UI_show_transparent_image(temp_x, (y1 + img_y1), image1, 0);

		}
		else
			temp_x = UI_device_width - MMI_fixed_icontext_menuitem.text_x;


		if (image3)
		{
			pixtel_UI_measure_image(image3, &width, &height);
			img_y1 = (MMI_INLINE_EDIT_MENUITEM_HEIGHT >> 1) - (height >> 1);
			temp_x -= (width + 2);
			pixtel_UI_show_transparent_image(temp_x, (y1 + img_y1), image3, 0);
			text_x = temp_x - 2;
			text_width = iwidth - (UI_device_width - text_x);
#ifdef __MMI_TOUCH_SCREEN__
			if (control)
			{
				control->image_left_top[1].x = temp_x;
				control->image_left_top[1].y = y1 + img_y1;
				control->image_right_bottom[1].x = temp_x + width - 1;
				control->image_right_bottom[1].y = y1 + img_y1 + height - 1;
			}
#endif
		}
		else
		{
			text_x = temp_x;
			text_width = iwidth - (UI_device_width - text_x) - 2;
		}

		if (image2)
		{
			pixtel_UI_measure_image(image2, &width, &height);
			img_y1 = (MMI_INLINE_EDIT_MENUITEM_HEIGHT >> 1) - (height >> 1);
			temp_x = (UI_device_width - 1) - iwidth + 2;
			pixtel_UI_show_transparent_image(temp_x, (y1 + img_y1), image2, 0);
			text_width = text_x - temp_x - 2 - width;
#ifdef __MMI_TOUCH_SCREEN__
			if (control)
			{
				control->image_left_top[0].x = temp_x;
				control->image_left_top[0].y = y1 + img_y1;
				control->image_right_bottom[0].x = temp_x + width - 1;
				control->image_right_bottom[0].y = y1 + img_y1 + height - 1;
			}
#endif
		}

	}


	char_height = pixtel_UI_get_character_height();

	pixtel_UI_measure_string((UI_string_type) text, &width, &height);
	text_height = height;
	text_y = y1 + (MMI_INLINE_EDIT_MENUITEM_HEIGHT >> 1) - (height >> 1);
	if (highlight_flag)
	{
		text_colr = MMI_fixed_icontext_menuitem.focussed_text_color;
		if (width > text_width)
		{
			if (r2lMMIFlag)
			{
				pixtel_UI_create_scrolling_text(&wgui_inline_scroll_text, text_x - text_width, text_y, text_width, text_height, (UI_string_type) text, wgui_inlinescrolling_timer, wgui_scrolling_text_draw_background, text_colr, text_colr);	//031205 Calvin modified
			}
			else
			{
				pixtel_UI_create_scrolling_text(&wgui_inline_scroll_text, text_x, text_y, text_width, text_height, (UI_string_type) text, wgui_inlinescrolling_timer, wgui_scrolling_text_draw_background, text_colr, text_colr);	//031205 Calvin modified
			}
			pixtel_UI_show_scrolling_text(&wgui_inline_scroll_text);
		}
		else
		{
			if (r2lMMIFlag)
				gdi_layer_set_clip(text_x - text_width, text_y - 1, text_x, text_y + text_height + 1);
			else
				gdi_layer_set_clip(text_x, text_y - 1, text_x + text_width, text_y + text_height + 1);

⌨️ 快捷键说明

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