wgui_categories_imps.c

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

C
1,967
字号

	/* Mood */
	sw = pixtel_UI_get_string_width((UI_string_type)GetString(CAT420_CTX->mood_caption));
	if (r2lMMIFlag)
		pixtel_UI_move_text_cursor(xoffset + CAT420_CTX->mood_caption_x + sw - 1, yoffset + CAT420_CTX->mood_caption_y);
	else
		pixtel_UI_move_text_cursor(xoffset + CAT420_CTX->mood_caption_x, yoffset + CAT420_CTX->mood_caption_y);
	pixtel_UI_print_text((UI_string_type)GetString(CAT420_CTX->mood_caption));
	pixtel_UI_show_transparent_image(xoffset + CAT420_CTX->mood_image_x, yoffset + CAT420_CTX->mood_image_y,
						CAT420_CTX->mood_icon, UI_DEFAULT_TRANSPARENT_COLOR);
#ifdef CAT420_DISP_INFO_TEXT
	sw = pixtel_UI_get_string_width(CAT420_CTX->mood_string);
	if (r2lMMIFlag)
		pixtel_UI_move_text_cursor(xoffset + CAT420_CTX->mood_text_x + sw - 1, yoffset + CAT420_CTX->mood_text_y);
	else
		pixtel_UI_move_text_cursor(xoffset + CAT420_CTX->mood_text_x, yoffset + CAT420_CTX->mood_text_y);
	pixtel_UI_print_text(CAT420_CTX->mood_string);
#endif

	/* Status */
	sw = pixtel_UI_get_string_width((UI_string_type)GetString(CAT420_CTX->status_caption));
	if (r2lMMIFlag)
		pixtel_UI_move_text_cursor(xoffset + CAT420_CTX->status_caption_x + sw - 1, yoffset + CAT420_CTX->status_caption_y);
	else
		pixtel_UI_move_text_cursor(xoffset + CAT420_CTX->status_caption_x, yoffset + CAT420_CTX->status_caption_y);
	pixtel_UI_print_text((UI_string_type)GetString(CAT420_CTX->status_caption));
	pixtel_UI_show_transparent_image(xoffset + CAT420_CTX->status_image_x, yoffset + CAT420_CTX->status_image_y,
						CAT420_CTX->status_icon, UI_DEFAULT_TRANSPARENT_COLOR);
#ifdef CAT420_DISP_INFO_TEXT
	sw = pixtel_UI_get_string_width(CAT420_CTX->status_string);
	if (r2lMMIFlag)
		pixtel_UI_move_text_cursor(xoffset + CAT420_CTX->status_text_x + sw - 1, yoffset + CAT420_CTX->status_text_y);
	else
		pixtel_UI_move_text_cursor(xoffset + CAT420_CTX->status_text_x, yoffset + CAT420_CTX->status_text_y);
	pixtel_UI_print_text(CAT420_CTX->status_string);
#endif

	/* Image */
	if (CAT420_CTX->display_image)
	{
		if (CAT420_CTX->image_resized_width == 0 || CAT420_CTX->image_resized_height == 0)
		{
			category420_show_cached_image(xoffset + CAT420_CTX->image_x_offset, yoffset + CAT420_CTX->image_y_offset, 
													CAT420_CTX->image_ori_width, CAT420_CTX->image_ori_height);
		}
		else
		{
			category420_show_cached_image(xoffset + CAT420_CTX->image_x_offset, yoffset + CAT420_CTX->image_y_offset, 
													CAT420_CTX->image_resized_width, CAT420_CTX->image_resized_height);
		}
	}
	gdi_draw_rect(xoffset + CAT420_CTX->image_area_x - 1, yoffset + CAT420_CTX->image_area_y - 1, 
		xoffset + CAT420_CTX->image_area_x + CAT420_CTX->image_area_width,
		yoffset + CAT420_CTX->image_area_y + CAT420_CTX->image_area_height, c);

	pixtel_UI_pop_text_clip();
	pixtel_UI_pop_clip();
}


/* 
 * Category 425
 */


static void category425_set_icontext_list_text_color(int col, color c1, color c2)
{
	MMI_fixed_icontext_list_menuitem.normal_text_colors[col] = c1;
	MMI_fixed_icontext_list_menuitem.disabled_text_colors[col] = c1;
	MMI_fixed_icontext_list_menuitem.selected_text_colors[col] = c2;
	MMI_fixed_icontext_list_menuitem.focussed_text_colors[col] = c2;
}

static void category425_setup_text_color(void)
{
	color c1, c2;

#ifdef __MMI_MAINLCD_240X320__
	c1 = *current_MMI_theme->list_normal_text_color;
	c2 = *current_MMI_theme->list_selected_text_color;
#else /* __MMI_MAINLCD_240X320__ */
	c1.r = CAT425_TEXT1_COLOR_R;
	c1.g = CAT425_TEXT1_COLOR_G;
	c1.b = CAT425_TEXT1_COLOR_B;
	c2.r = CAT425_TEXT1_HIGHLIGHT_COLOR_R;
	c2.g = CAT425_TEXT1_HIGHLIGHT_COLOR_G;
	c2.b = CAT425_TEXT1_HIGHLIGHT_COLOR_B;	
#endif /* __MMI_MAINLCD_240X320__ */
	category425_set_icontext_list_text_color(0, c1, c2);

#ifndef __MMI_MAINLCD_240X320__
	c1.r = CAT425_TEXT2_COLOR_R;
	c1.g = CAT425_TEXT2_COLOR_G;
	c1.b = CAT425_TEXT2_COLOR_B;
	c2.r = CAT425_TEXT2_HIGHLIGHT_COLOR_R;
	c2.g = CAT425_TEXT2_HIGHLIGHT_COLOR_G;
	c2.b = CAT425_TEXT2_HIGHLIGHT_COLOR_B;
#endif /* ~__MMI_MAINLCD_240X320__ */
	category425_set_icontext_list_text_color(1, c1, c2);
}

static void category425_reset_context(void)
{
	MMI_fixed_list_menu.flags = CAT425_CTX->backup_menu_flags;
	MMI_fixed_list_menu.normal_filler = CAT425_CTX->backup_menu_filler; 
	fixed_icontext_list_menuitem_apply_current_theme();
	
	OslMfree(g_mmi_gui_cat425_context_p);
	g_mmi_gui_cat425_context_p = NULL;
}

static void category425_post_display_menuitem(void* item,void *common_item_data,s32 x,s32 y)
{
	color c;
	fixed_icontext_list_menuitem			*m=(fixed_icontext_list_menuitem*)common_item_data;
	fixed_icontext_list_menuitem_type	*mi=(fixed_icontext_list_menuitem_type*)item;
	S32 x2, y2;
	gdi_color border_color;

	x2 = x + m->width - 1;
	y2 = y + m->height - 1;

	pixtel_UI_push_clip();
	pixtel_UI_set_clip(x, y, x2, y2);

	border_color = 
		(gdi_color) ((mi->flags & UI_MENUITEM_STATE_FOCUSSED) ? 
			gdi_act_color_from_rgb(255, CAT425_ICON_HIGHLIGHT_BORDER_COLOR_R, CAT425_ICON_HIGHLIGHT_BORDER_COLOR_G, CAT425_ICON_HIGHLIGHT_BORDER_COLOR_B):
			gdi_act_color_from_rgb(255, CAT425_ICON_BORDER_COLOR_R, CAT425_ICON_BORDER_COLOR_G, CAT425_ICON_BORDER_COLOR_B));

	c.r = CAT425_TEXT2_BRACKET_COLOR_R;
	c.g = CAT425_TEXT2_BRACKET_COLOR_G;
	c.b = CAT425_TEXT2_BRACKET_COLOR_B;
	pixtel_UI_set_text_color(c);
	if (r2lMMIFlag)
	{
		pixtel_UI_move_text_cursor(x2 - CAT425_CTX->bracket_x, y + CAT425_CTX->bracket_y);
		pixtel_UI_print_text((UI_string_type) L"]");
		pixtel_UI_move_text_cursor(x2 - m->text_coordinates[1].x - m->text_coordinates[1].width- CAT425_TEXT2_BRACKET_GAP, 
										y + CAT425_CTX->bracket_y);
		pixtel_UI_print_text((UI_string_type) L"[");	

		gdi_draw_rect(
				x2 - CAT425_CTX->icon_border_x1, y + CAT425_CTX->icon_border_y1, 
				x2 - CAT425_CTX->icon_border_x2, y + CAT425_CTX->icon_border_y2, 
				border_color);
	}
	else
	{
		pixtel_UI_move_text_cursor(x + CAT425_CTX->bracket_x, y + CAT425_CTX->bracket_y);
		pixtel_UI_print_text((UI_string_type) L"[");
		pixtel_UI_move_text_cursor(x + m->text_coordinates[1].x + m->text_coordinates[1].width+ CAT425_TEXT2_BRACKET_GAP, 
										y + CAT425_CTX->bracket_y);
		pixtel_UI_print_text((UI_string_type) L"]");

		gdi_draw_rect(
				x + CAT425_CTX->icon_border_x1, y + CAT425_CTX->icon_border_y1, 
				x + CAT425_CTX->icon_border_x2, y + CAT425_CTX->icon_border_y2, 
				border_color);		
	}

	gdi_draw_line_style(x, y2, x2, y2, 
			gdi_act_color_from_rgb(255, CAT425_LINE_COLOR_R, CAT425_LINE_COLOR_G, CAT425_LINE_COLOR_B),
			sizeof(g_mmi_gui_cat425_line_bitvalues), g_mmi_gui_cat425_line_bitvalues);

	pixtel_UI_pop_clip();
}


/* 
 * Category 430
 */

/* b is configured, and b->height is computed */
static void category430_create_sending_box(multi_line_input_box *b, S16 x, S16 y)
{
	S32 length;
	S32 read_index;
	mmi_wpixtel_UI_color_buffer_writer_struct writer;
	S32 n_lines, fh, h;
	
	length = pixtel_UI_strlen((UI_string_type) CAT430_CTX->sending_buffer);

	/* Create color text buffer */
	MMI_ASSERT(CAT430_CTX->sent_count <= length && length <= CAT430_CTX->max_sending_buffer_size);

	CAT430_CTX->allocated_color_buffer[0] = CAT430_CTX->allocated_color_buffer[1] = 0;
	mmi_wpixtel_UI_color_buffer_create_writer(&writer, CAT430_CTX->allocated_color_buffer, CAT430_CTX->allocated_color_buffer_size);
	mmi_wpixtel_UI_color_buffer_write_char(&writer, GUI_INPUT_COLOR_BLACK);
	for (read_index = 0; read_index < CAT430_CTX->sent_count; read_index++)
	{
		mmi_wpixtel_UI_color_buffer_write_char(&writer, *((U16*) &CAT430_CTX->sending_buffer[read_index<<1]));
	}
	mmi_wpixtel_UI_color_buffer_write_char(&writer, GUI_INPUT_COLOR_TEAL);
	for (read_index = CAT430_CTX->sent_count; read_index < length; read_index++)
	{
		mmi_wpixtel_UI_color_buffer_write_char(&writer, *((U16*) &CAT430_CTX->sending_buffer[read_index<<1]));		
	}	
	
	pixtel_UI_create_multi_line_input_box_set_buffer(b, 
		x, y, CAT430_CTX->sending_box_width, UI_device_height /* max height */,
		(UI_string_type) CAT430_CTX->allocated_color_buffer, 
		CAT430_CTX->max_sending_buffer_size * 2, (length + 1)*2, 0);
	
	b->flags|=(UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW|UI_MULTI_LINE_INPUT_BOX_VIEW_MODE | UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR|UI_MULTI_LINE_INPUT_BOX_RICHTEXT);
	b->normal_filler = (UI_filled_area*) &g_mmi_gui_cat430_sending_filler;
	
	/* 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;

	/* Setup height (reference: resize_multiline_inputbox_fit) */
	n_lines=b->n_lines;
	fh=MMI_multiline_inputbox.max_line_height;
	if (fh == 0) fh = 1;
	h=n_lines*fh+b->text_y;
	pixtel_UI_resize_multi_line_input_box(b, b->width,h);
}

static void category430_setup_sending_box(void)
{
	multi_line_input_box b;

	if (CAT430_CTX->show_sending_buffer)
	{
		CAT430_CTX->sending_box_x = CAT430_SENDING_BOX_H_GAP;
		CAT430_CTX->sending_box_y = CAT430_SENDING_BOX_V_GAP;
		CAT430_CTX->sending_box_width = CAT430_CTX->log_box2_width - 
				2 * CAT430_SENDING_BOX_H_GAP - current_multi_line_input_box_theme->vbar_width;
		category430_create_sending_box(&b, 0, 0);
		CAT430_CTX->log_box2_footer_height = b.height + 2 * CAT430_SENDING_BOX_V_GAP;
	}
	else
	{
		CAT430_CTX->log_box2_footer_height = 0;
	}
}

#ifdef CAT430_NAME_IN_LOG

static void category430_header1_callback(s32 yoffset, s32 clip_x1, s32 clip_y1, s32 clip_x2, s32 clip_y2)
{
	S32 sw;

	pixtel_UI_push_clip();
	pixtel_UI_set_clip(clip_x1, clip_y1, clip_x2, clip_y2);

	pixtel_UI_set_font(CAT430_NAME_FONT);
	sw = pixtel_UI_get_string_width((UI_string_type)CAT430_CTX->name1);
	
	if (r2lMMIFlag) 
		pixtel_UI_move_text_cursor(CAT430_CTX->log_box1_x + CAT430_HORIZONTAL_GAP + sw - 1,  yoffset);
	else 
		pixtel_UI_move_text_cursor(CAT430_CTX->log_box1_x + CAT430_HORIZONTAL_GAP, yoffset); 
	pixtel_UI_set_text_color(pixtel_UI_color(CAT430_NAME1_COLOR_R, CAT430_NAME1_COLOR_G, CAT430_NAME1_COLOR_B));
	pixtel_UI_print_text((UI_string_type)CAT430_CTX->name1);

	pixtel_UI_pop_clip();

}

static void category430_header2_callback(s32 yoffset, s32 clip_x1, s32 clip_y1, s32 clip_x2, s32 clip_y2)
{
	S32 sw;

	pixtel_UI_push_clip();
	pixtel_UI_set_clip(clip_x1, clip_y1, clip_x2, clip_y2);
	
	pixtel_UI_set_font(CAT430_NAME_FONT);
	sw = pixtel_UI_get_string_width((UI_string_type)CAT430_CTX->name2);
	
	if (r2lMMIFlag) 
		pixtel_UI_move_text_cursor(CAT430_CTX->log_box2_x + CAT430_HORIZONTAL_GAP + sw - 1,  yoffset);
	else 
		pixtel_UI_move_text_cursor(CAT430_CTX->log_box2_x + CAT430_HORIZONTAL_GAP, yoffset); 
	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);
	
	pixtel_UI_pop_clip();
}

#endif /* CAT430_NAME_IN_LOG */

static void category430_footer_callback(s32 yoffset, s32 clip_x1, s32 clip_y1, s32 clip_x2, s32 clip_y2)
{
	multi_line_input_box b;
	category430_create_sending_box(&b, (S16)CAT430_CTX->sending_box_x, (S16)(yoffset + CAT430_CTX->sending_box_y));
	b.flags |= UI_MULTI_LINE_INPUT_BOX_USE_PRESET_CLIPPING;
	pixtel_UI_push_clip();
	pixtel_UI_set_clip(clip_x1, clip_y1, clip_x2, clip_y2);
	pixtel_UI_show_multi_line_input_box(&b);
	pixtel_UI_pop_clip();
}

static void category430_setup_log_box1(void)
{
	/* 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 = &CAT430_CTX->log_box1;

	log_length=pixtel_UI_strlen((UI_string_type) CAT430_CTX->log_buffer1);
	pixtel_UI_create_multi_line_input_box_set_buffer(b, 
				CAT430_CTX->log_box1_x, CAT430_CTX->log_box1_y,
				CAT430_CTX->log_box1_width, CAT430_CTX->log_box1_height,
				(UI_string_type) CAT430_CTX->log_buffer1, 
				CAT430_CTX->log_buffer_size1 * 2, (log_length + 1)*2, 0);

#ifdef CAT430_NAME_IN_LOG
	b->header_height = CAT430_CTX->log_box_header_height;
	b->header_callback = category430_header1_callback;
#endif

	b->flags|=(UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW|UI_MULTI_LINE_INPUT_BOX_VIEW_MODE);
	b->normal_filler = (UI_filled_area*) &g_mmi_gui_cat430_logbox_filler;

	/* 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);
	}
}


static void category430_setup_log_box2(void)
{
	/* 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 = &MMI_multiline_inputbox;

	log_length=pixtel_UI_strlen((UI_string_type) CAT430_CTX->log_buffer2);
	pixtel_UI_create_multi_line_input_box_set_buffer(b, 
				CAT430_CTX->log_box2_x, CAT430_CTX->log_box2_y,
				CAT430_CTX->log_box2_width, CAT430_CTX->log_box2_height,
				(UI_string_type) CAT430_CTX->log_buffer2, 
				CAT430_CTX->log_buffer_size2 * 2, (log_length + 1)*2, 0);

#ifdef CAT430_NAME_IN_LOG
	b->header_height = CAT430_CTX->log_box_header_height;
	b->header_callback = category430_header2_callback;
#endif
	b->footer_height = CAT430_CTX->log_box2_footer_height;
	b->footer_callback = category430_footer_callback;
	b->max_empty_text_height = 1; /* For the case sending box is not empty but log box2 is empty. */

	b->flags|=(UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW|UI_MULTI_LINE_INPUT_BOX_VIEW_MODE);
	b->normal_filler = (UI_filled_area*) &g_mmi_gui_cat430_logbox_filler;
	
	/* 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 category430_draw_content_area(void)
{
#ifndef CAT430_NAME_IN_LOG   
	S32 sw;
#endif

#ifndef __MMI_WALLPAPER_ON_BOTTOM__
	pixtel_UI_draw_filled_area(MMI_content_x, MMI_content_y, 
		MMI_content_x + MMI_content_width - 1, MMI_content_y + MMI_content_height - 1,
		MMI_fixed_list_menu.normal_filler);
#endif 

#ifndef CAT430_NAME_IN_LOG   
	pixtel_UI_set_font(CAT430_NAME_FONT);
	sw = pixtel_UI_get_string_width((UI_string_type)CAT430_CTX->name1);
	
	if (r2lMMIFlag) 
		pixtel_UI_move_text_cursor(CAT430_CTX->name1_x + sw - 1,  CAT430_CTX->name1_y);
	else 
		pixtel_UI_move_text_cursor(CAT430_CTX->name1_x, CAT430_CTX->name1_y); 
	pixtel_UI_set_text_color(pixtel_UI_color(CAT430_NAME1_COLOR_R, CAT430_NAME1_COLOR_G, CAT430_NAME1_COLOR_B));
	pixtel_UI_print_text((UI_string_type)CAT430_CTX->name1);

	sw = pixtel_UI_get_string_width((UI_string_type)CAT430_CTX->name2);
	
	if (r2lMMIFlag) 
		pixtel_UI_move_text_cursor(CAT430_CTX->name2_x + sw - 1,  CAT430_CTX->name2_y);
	else 
		pixtel_UI_move_text_cursor(CAT430_CTX->name2_x, CAT430_CTX->name2_y); 

⌨️ 快捷键说明

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