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

📄 mosaic_ui.c

📁 c语言编的
💻 C
📖 第 1 页 / 共 5 页
字号:
/* 
 * File: uimosaic.c
 * Contains:
 *      the file of mosaic application for using
 *
 * Author:
 *      stone
 *
 * CVS control words:
 *
 * $Id: mosaic_ui.c,v 1.7 2006/02/10 09:34:27 wjbai Exp $ 
 *
 * Last checked in:
 * $Date: 2006/02/10 09:34:27 $ 
 *
 * History:
 *      $Log: mosaic_ui.c,v $
 *      Revision 1.7  2006/02/10 09:34:27  wjbai
 *      Add the ca macro MEDIAGUARD_CA.
 *
 *      Revision 1.6  2006/01/20 06:15:17  syan
 *      no message
 *
 *      Revision 1.5  2006/01/18 07:55:52  syan
 *      no message
 *
 *      Revision 1.4  2005/12/20 09:03:00  hwxiao
 *      no message
 *
 *      Revision 1.3  2005/11/14 03:38:12  wjbai
 *      update after reduce the code
 *
 *      Revision 1.2  2005/07/04 07:03:09  hwxiao
 *      no message
 *
 *      Revision 1.1.1.1  2005/06/28 08:52:23  wjbai
 *      no message
 *
 *      Revision 1.45  2005/03/31 03:14:17  syan
 *      no message
 *
 *      Revision 1.44  2005/03/29 05:13:04  syan
 *      no message
 *
 *      Revision 1.43  2005/03/23 06:46:51  syan
 *      no message
 *
 *      Revision 1.42  2005/03/17 01:46:16  syan
 *      no message
 *
 *      Revision 1.41  2005/03/14 02:18:46  syan
 *      no message
 *
 *      Revision 1.40  2005/03/04 03:22:48  syan
 *      modify multi-opi of mask.
 *
 *      Revision 1.39  2005/02/06 05:21:00  syan
 *      no message
 *
 *      Revision 1.38  2005/02/05 01:36:34  syan
 *      modify get event info 5 times until it is success.
 *
 *      Revision 1.37  2005/02/03 15:03:42  syan
 *      modify play audio when background is still pic but all audio in same service and add multi-opi.
 *
 *      Revision 1.36  2005/02/02 01:52:10  syan
 *      add play video audio and still picture when no PMT.
 *
 *      Revision 1.35  2005/01/27 14:19:56  syan
 *      modify enter page and play audio when no PMT.
 *
 *      Revision 1.34  2005/01/26 01:22:13  syan
 *      modify about the lock message.
 *
 *      Revision 1.33  2005/01/12 01:36:54  syan
 *      no message
 *
 *      Revision 1.32  2004/12/29 05:53:26  syan
 *      modify a bug of exit the mosaic app.
 *
 *      Revision 1.31  2004/12/02 01:24:53  syan
 *      modify the code of find app in database.
 *
 *      Revision 1.30  2004/11/10 08:20:00  syan
 *      modify mo app of a cell.
 *
 *      Revision 1.29  2004/11/05 01:19:50  syan
 *      modify lock cell.entry background.
 *
 *      Revision 1.28  2004/11/01 02:24:56  syan
 *      modify the lock mask of a cell, play audio.
 *
 *      Revision 1.27  2004/10/28 08:29:03  syan
 *      use new pallette(177 nums) and delete cache data when enter browser.
 *
 *      Revision 1.26  2004/10/26 13:22:25  syan
 *      modify about when background pis is NULL, delete audio,vol rect,
 *      get PMT...
 *
 *      Revision 1.25  2004/10/20 11:01:55  syan
 *      modify the clear screen.
 *
 *      Revision 1.24  2004/10/20 05:12:06  syan
 *      modify a new palette.
 *
 *      Revision 1.23  2004/09/03 06:15:20  syan
 *      stop the vid before enter new page function.
 *
 *      Revision 1.22  2004/08/30 07:48:07  syan
 *      modify the digital BeiJing.
 *
 *      Revision 1.21  2004/08/06 01:38:08  syan
 *      check the pin enable before lock mask.
 *
 *      Revision 1.20  2004/07/26 11:07:49  syan
 *      add the ss_connect_app.
 *
 *      Revision 1.19  2004/07/21 12:46:51  syan
 *      support the AIT.
 *
 *      Revision 1.18  2004/07/14 01:32:21  syan
 *      modify a page on an other TS.
 *
 *      Revision 1.17  2004/07/09 11:16:05  syan
 *      modify the cell navigation , geo mask.
 *
 *      Revision 1.16  2004/07/01 08:52:26  syan
 *      CA mask and modify some color.
 *
 *      Revision 1.15  2004/06/21 02:26:21  syan
 *      support multilingual in page area display.
 *
 *      Revision 1.14  2004/06/18 05:31:47  syan
 *      support multilingual info area display in a page.
 *
 *      Revision 1.13  2004/06/16 11:40:09  syan
 *      modify multilingual text display in mask and page.
 *
 *      Revision 1.12  2004/06/16 05:52:54  syan
 *      modify multilingual text display in page.
 *
 *      Revision 1.11  2004/06/03 01:41:07  syan
 *      modify some data structure and VK in MOSAIC.
 *
 *      Revision 1.10  2004/05/25 01:00:34  syan
 *      modify page display function to display the test page correctly.
 *
 *      Revision 1.9  2004/05/11 08:17:23  syan
 *      add mask and color_index from the stream.
 *
 *      Revision 1.8  2004/04/27 09:41:35  syan
 *      no message
 *
 *      Revision 1.7  2004/04/16 09:17:39  syan
 *      SDT info and supporting multi-net had been modified.
 *
 *      Revision 1.6  2004/04/07 02:44:59  syan
 *      no message
 *
 *      Revision 1.5  2004/04/05 11:16:58  syan
 *      no message
 *
 *      Revision 1.4  2004/03/29 09:47:36  syan
 *      no message
 *
 *      Revision 1.3  2004/03/12 05:34:18  syan
 *      provide other application linking
 *
 *      Revision 1.2  2004/02/04 08:54:01  dsqu
 *      no message
 *
 *      Revision 1.1  2004/01/07 12:46:51  dsqu
 *      Initial creation
 *
 *      Revision 1.1.1.1  2003/12/23 10:07:01  stone
 *      no message
 *
 *
 */
#include <stdio.h>
#include <string.h>
#include "stddefs.h"
#include "stcommon.h"
#include "modules.h"
#include "mosaic.h"

extern mosaic_node_t *mosaic_tree_data_t;

extern mosaic_data_t *mosaic_node_data;
extern page_data_t *page_node_data;
extern cell_data_t *cell_node_data;

extern semaphore_t *connect_ok;
extern uint8_t mosaic_pmt[1024];

extern component_t ms_audio_component;
extern service_t   ms_service;
extern ms_network_data_t ms_network_data;

extern ms_eitpf_event_t ms_eitpf_event[2];
extern uint8_t ms_info_pf_state;

extern db_service_list_t si_service_list;

extern int16_t	ms_pre_eitpf_version_number;

#ifdef MEDIAGUARD_CA
extern TMGAPIOperator ms_net_operator, ms_net_opi[MS_MAX_OPERATOR];
extern int32_t ms_actual_operator;
#endif

extern db_mosaic_service_list_t ms_list;

extern time_date_t ms_cur_offer_time;


uint16_t mosaic_get_component_pid(uint8_t *pmt, uint8_t component_tag);
error_t si_cache_request_picture_table( uint16_t picture_id,
										uint8_t **table,
										int32_t *size,
										uint16_t *picture_format,
										int32_t timeout);

void ms_send_pin(uint16_t on_id, uint16_t ts_id, uint16_t service_id);
uint16_t ms_get_pid(uint8_t component_tag);

static uint8_t ms_reg_value;
static error_t ms_pin_err;
static hitune_ui_bitmap_t *ms_focus_background_p;

static page_data_t *cur_page_node_data;
static boolean ms_pmt_flag = FALSE;


void ms_reset_version_number(void)
{
	ms_eitpf_event[0].version_number = -1;
	ms_eitpf_event[1].version_number = -1;
}

error_t ms_no_event_info(ui_rect_t rect, uint8_t h_alignment, uint8_t v_alignment, uint8_t f_color, uint8_t b_color)
{
	ms_pre_eitpf_version_number = -2;
   	ms_STWTK_DynamicTextInRect(hitune_ui_draw_get_context(), 
   	                        rect.x, 
   	                        rect.y, 
   	                        rect.w, 
   	                        rect.h, 
   	                        string_value(res_data(RES_STRING_NO_INFO)), 
   	                        0, 0, 
   	                        h_alignment, v_alignment,
   	                        f_color,
	                        b_color);
	return SUCCESS;
}

uint8_t ms_get_display_alignment(uint8_t alignment)
{
	switch(alignment)
	{
		case 0x01: 
			alignment = JLEFT;
			break;
			
		case 0x02: 
			alignment = JCENTER;
			break;
		
		case 0x03:
			alignment = JRIGHT;
			break;								
	}
	return alignment;
}


ST_ErrorCode_t ms_HL_STOSD_DrawRectangle(void *context_p, U32 x, U32 y, U32 width, U32 height, STOSD_Color_t color)
{
	ST_ErrorCode_t returnError;
	
	y -= 2;
	width += 1;
	
	/*top horizontal line*/
	if ((returnError=hitune_ui_draw_line(context_p, x, y, x+width+1, y, color.Value.PaletteEntry, 1)) != ST_NO_ERROR)
	{
		return returnError;
	}
	/*right vertical line*/
	if ((returnError=hitune_ui_draw_line(context_p, x+width, y, x+width, y+height, color.Value.PaletteEntry, 1)) != ST_NO_ERROR)
	{
		return returnError;
	}
	/*bottom horizontal line*/
	if ((returnError=hitune_ui_draw_line(context_p, x+width+1, y+height, x, y+height, color.Value.PaletteEntry, 1)) != ST_NO_ERROR)
	{
		return returnError;
	}
	/*left vertical line*/
	if ((returnError=hitune_ui_draw_line(context_p, x, y+height, x, y, color.Value.PaletteEntry, 1)) != ST_NO_ERROR)
	{
		return returnError;
	}

	return ST_NO_ERROR;
}


error_t ms_draw_focus(int16_t x, int16_t y, int16_t w, int16_t h)
{
	error_t error;
	uint8_t focus_type, corner_type, color_index;
	int16_t i;
	
	ui_color_t color;
		
	y -= ADJUST_POSITIONY;/*adjust the focus position*/
	
	focus_type = mosaic_node_data->focus_data.focus_type;
	corner_type = mosaic_node_data->focus_data.corner_type;
	
	/*find the color in the sys palette*/
	color_index = mosaic_get_color_index(mosaic_node_data->focus_data.focus_color_index);
	APP_TRACE("\n############ the color_index in the stream [%d], in the sys palette is [%d]\n",
	          mosaic_node_data->focus_data.focus_color_index, color_index);
	
	error = ui_change_index_to_stcolor(&color_index, &color);
	
	if(focus_type == 0x01)/*solid rectangle*/
	{
		if(corner_type == 0x01)/*square*/
		{
			ui_draw_panel(hitune_ui_draw_get_context(), x, y, w, h, UI_PANEL_RECTANGLE, color.Value.PaletteEntry);
	    }
	    else if(corner_type == 0x02)/*round*/
	    {
	    	w = 2*w/(h-2);
	    	
			hitune_ui_draw_filled_circle(hitune_ui_draw_get_context(), x + w, y + h/4, h/4 - 1, color.Value.PaletteEntry); 
			ui_draw_panel(hitune_ui_draw_get_context(), x + w, y + h/4 - 1, h/4 - 1, h/2 + 2, UI_PANEL_RECTANGLE, color.Value.PaletteEntry);
			hitune_ui_draw_filled_circle(hitune_ui_draw_get_context(), x + w, y + h*3/4, h/4 - 1, color.Value.PaletteEntry); 						    		   									 
			hitune_ui_draw_filled_circle(hitune_ui_draw_get_context(), x, y + h*3/4, h/4 - 1, color.Value.PaletteEntry);
			ui_draw_panel(hitune_ui_draw_get_context(), x - h/4, y + h/4, h/4 - 1, h/2, UI_PANEL_RECTANGLE, color.Value.PaletteEntry);
			hitune_ui_draw_filled_circle(hitune_ui_draw_get_context(), x, y + h/4, h/4 - 1, color.Value.PaletteEntry);
			ui_draw_panel(hitune_ui_draw_get_context(), x, y, w, h, UI_PANEL_RECTANGLE, color.Value.PaletteEntry);
		}
	}
	if(focus_type == 0x02)/*frame*/
	{
		if(corner_type == 0x01)
		{
			/*save the cell focus background*/
			i = mosaic_node_data->focus_data.focus_thickness;
			
			ms_focus_background_p = hitune_ui_get_background(x-i, y-i - 2, w+2*i + 1, h+2*i);
			for(i = 0; i < mosaic_node_data->focus_data.focus_thickness; i++)
			{
				error = ms_HL_STOSD_DrawRectangle(hitune_ui_draw_get_context(), x-i, y-i, w+2*i, h+2*i, color);
			}
		}
		else if(corner_type == 0x02)
		{
			w = 2*w/(h-2);
			hitune_ui_draw_circle(hitune_ui_draw_get_context(), x + w, y + h/4, h/4 - 1, color.Value.PaletteEntry, 1);
			ms_HL_STOSD_DrawRectangle(hitune_ui_draw_get_context(), x + w, y + h/4 - 1, h/4 - 1, h/2 + 2, color);	
			hitune_ui_draw_circle(hitune_ui_draw_get_context(), x + w, y + h*3/4, h/4 - 1, color.Value.PaletteEntry, 1);					    		   									 
			hitune_ui_draw_circle(hitune_ui_draw_get_context(), x, y + h*3/4, h/4 - 1, color.Value.PaletteEntry, 1);
			ms_HL_STOSD_DrawRectangle(hitune_ui_draw_get_context(), x - h/4, y + h/4, h/4 - 1, h/2, color); 
			hitune_ui_draw_circle(hitune_ui_draw_get_context(), x, y + h/4, h/4 - 1, color.Value.PaletteEntry, 1);
			ms_HL_STOSD_DrawRectangle(hitune_ui_draw_get_context(), x, y, w, h, color);
			
			hitune_ui_draw_circle(hitune_ui_draw_get_context(), x + w, y + h/4, h/4, color.Value.PaletteEntry, 1);
			ms_HL_STOSD_DrawRectangle(hitune_ui_draw_get_context(), x + w-1, y + h/4 - 2, h/4 + 1, h/2 + 4, color);	
			hitune_ui_draw_circle(hitune_ui_draw_get_context(), x + w, y + h*3/4, h/4, color.Value.PaletteEntry, 1);
			hitune_ui_draw_circle(hitune_ui_draw_get_context(), x, y + h*3/4, h/4, color.Value.PaletteEntry, 1); 
			ms_HL_STOSD_DrawRectangle(hitune_ui_draw_get_context(), x - h/4-1, y + h/4-1, h/4 + 1, h/2+2, color); 
			hitune_ui_draw_circle(hitune_ui_draw_get_context(), x, y + h/4, h/4, color.Value.PaletteEntry, 1); 
			ms_HL_STOSD_DrawRectangle(hitune_ui_draw_get_context(), x-1, y-1, w+2, h+2, color);
		}	

⌨️ 快捷键说明

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