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

📄 tidtv_usermenuapi.c

📁 ti的数字电视芯片 tvp9000的源码
💻 C
📖 第 1 页 / 共 4 页
字号:
*
*	@Description:: create the main menu and display
*
*	@Input		:: USHORT xPos, USHORT yPos, USHORT Width, USHORT Height
*					
*	@Output		:: none
*
*	@Return	int	:: none
*******************************************************************************/

void TiDTV_CreateSubFrame(USHORT xPos, USHORT yPos, USHORT Width, USHORT Height)
{
	USHORT i,j,xPos_Current,yPos_Current,Origin_x,Origin_y, Origin_w,Origin_h;
	USHORT  Bmp_index;


	if(xPos == 0 && yPos == 0 && Width == 0 && Height == 0)
	{	
		Origin_x = MENU_XPOSITION + DIST_MAIN_SUB + MENUPIECE_H_WIDTH * MAIN_MENU_H_STEP;
		Origin_y = MENU_YPOSITION;
		Origin_w = MENUPIECE_H_WIDTH * SUB_MENU_H_STEP;
		Origin_h = MENUPIECE_V_HEIGHT * SUB_MENU_V_STEP;
	}
	else
	{
		// for future use
	}
	
	// j is vertical counter, and i is horizontal counter
	for(j = 0; j < Origin_h; j = j + MENUPIECE_V_HEIGHT)
	{
		for(i = 0; i < Origin_w; i =  i + MENUPIECE_H_WIDTH)
		{
			if ((i == 0)&&(j == 0))		// if is left up corner
			{
				Bmp_index = BMP_MAINLEFTUP;
			}
			else if ((i == Origin_w - MENUPIECE_H_WIDTH) && (j == 0)) 
			{	// if it's right up corner
				Bmp_index = BMP_MAINRIGHTUP;
			}	
		
			else if((i == 0)&&(j == Origin_h - MENUPIECE_V_HEIGHT))
			{	// if it's left bottom corner
				Bmp_index = BMP_MAINLEFTBOTTOM;
			}
			else if((i == Origin_w - MENUPIECE_H_WIDTH)
					&&(j == Origin_h - MENUPIECE_V_HEIGHT))
			{	// if it's right bottom corner
				Bmp_index = BMP_MAINRIGHTBOTTOM;
			}
			else if(j == 0)
			{	// if it's Center Top edge
				Bmp_index = BMP_MAINCENTERUP;
			}
			else if(j == Origin_h - MENUPIECE_V_HEIGHT)
			{	// if it's center bottem edge 
				Bmp_index = BMP_MAINCENTERBOTTOM;
			}
			else
			{	// other place
				Bmp_index = BMP_MAINCENTER;
			}
			xPos_Current = Origin_x + i;
			yPos_Current = Origin_y + j;

			TiDTV_OsdMove(&TiDTV_OsdScreenMain, xPos_Current, yPos_Current);
			TiDTV_OsdDrawBitMap(&TiDTV_OsdScreenMain, Bmp_index);

		}	
	}
	
	TiDTV_OsdSetCharColor(&TiDTV_OsdScreenMain, SUB_MENU_CHARACTER_UNSEL_FRONTCOLOR, 0);

	xPos_Current = SUB_MENU_XPOSITION + 16;
	
	TiDTV_OsdMove(&TiDTV_OsdScreenMain, xPos_Current, SUB_MENU_NAVIGATION_YPOSITION);
	TiDTV_OsdDrawString(&TiDTV_OsdScreenMain, pCurDtvMsgBase[NAVIGATIONENTERSET_INDEX] );

	xPos_Current = SUB_MENU_XPOSITION + 126;
	TiDTV_OsdMove(&TiDTV_OsdScreenMain, xPos_Current, SUB_MENU_NAVIGATION_YPOSITION);
	TiDTV_OsdDrawString(&TiDTV_OsdScreenMain, pCurDtvMsgBase[NAVIGATIONCACNEL_INDEX] );

	xPos_Current = SUB_MENU_XPOSITION + 285;
	TiDTV_OsdMove(&TiDTV_OsdScreenMain, xPos_Current, SUB_MENU_NAVIGATION_YPOSITION);
	TiDTV_OsdDrawString(&TiDTV_OsdScreenMain, pCurDtvMsgBase[NAVIGATIONMOVE_INDEX] );

	xPos_Current = SUB_MENU_XPOSITION + 430;
	TiDTV_OsdMove(&TiDTV_OsdScreenMain, xPos_Current, SUB_MENU_NAVIGATION_YPOSITION);
	TiDTV_OsdDrawString(&TiDTV_OsdScreenMain, pCurDtvMsgBase[NAVIGATIONEXIT_INDEX] );

} 



/*******************************************************************************
*	@RoutineName:: TiDTV_UpdateSubFrameMiddleBlock
*
*	@Description:: create the main menu and display
*
*	@Input		:: USHORT xPos, USHORT yPos, USHORT Width, USHORT Height
*					
*	@Output		:: none
*
*	@Return	int	:: none
*******************************************************************************/

void TiDTV_UpdateSubFrameMiddleBlock(USHORT xPos, USHORT yPos, USHORT Width, USHORT Height)
{
	USHORT i,j,xPos_Current,yPos_Current,Origin_x,Origin_y, Origin_w,Origin_h;
	USHORT  Bmp_index;


	if(xPos == 0 && yPos == 0 && Width == 0 && Height == 0)
	{	
		Origin_x = MENU_XPOSITION + DIST_MAIN_SUB + MENUPIECE_H_WIDTH * MAIN_MENU_H_STEP;
		Origin_y = MENU_YPOSITION + MENUPIECE_V_HEIGHT;
		Origin_w = MENUPIECE_H_WIDTH * SUB_MENU_H_STEP;
		Origin_h = MENUPIECE_V_HEIGHT * (SUB_MENU_V_STEP - 2);
	}
	else
	{
		// for future use
	}
	
	// j is vertical counter, and i is horizontal counter
	for(j = 0; j < Origin_h; j = j + MENUPIECE_V_HEIGHT)
	{
		for(i = 0; i < Origin_w; i =  i + MENUPIECE_H_WIDTH)
		{
			Bmp_index = BMP_MAINCENTER;
			
			xPos_Current = Origin_x + i;
			
			if(j == Origin_h - MENUPIECE_V_HEIGHT)
			{
				yPos_Current = Origin_y + 32;
			}
			else
			{
				yPos_Current = Origin_y + j;
			}
			TiDTV_OsdMove(&TiDTV_OsdScreenMain, xPos_Current, yPos_Current);
			TiDTV_OsdDrawBitMap(&TiDTV_OsdScreenMain, Bmp_index);
		}	
	}
} 


/*******************************************************************************
*	@RoutineName:: TiDTV_DisplayMenuGuageInitFuct
*
*	@Description:: Mode Init
*
*	@Input		:: TI_DTV_MENU_ITEM *pMenuItem, short * UserPreferOffset, USHORT Min, USHORT Max
*		
*
*	@Output		:: none
*
*	@Return		:: none
*******************************************************************************/

void	TiDTV_DisplayMenuGuageInitFuct(TI_DTV_MENU_ITEM *pMenuItem, short * UserPreferOffset, short Min, short Max)
{
	USHORT  xPos, yPos;

	
	///////////////////////////////////////////////////////////////////		
	// high light itself first
	///////////////////////////////////////////////////////////////////
		// draw guage
	xPos = SUB_MENU_GUAGE_XPOSITION;
	yPos =	pMenuItem->MsgY;			

	// currently initial guage every time
	TiDTV_DrawGuage( TIDTV_GUAGE_NOTHIGHLIGHT, xPos, yPos,	SUB_MENU_GUAGE_LENGTH, Min, 
			Max, (short)*UserPreferOffset, 0, SUB_MENU_CHARACTER_UNSEL_FRONTCOLOR);	 	

}



/*******************************************************************************
*	@RoutineName:: TiDTV_DisplayMenuGuageActFuct
*
*	@Description:: 
*
*	@Input		::None
*		
*
*	@Output		:: none
*
*	@Return		:: none
*******************************************************************************/

int TiDTV_DisplayMenuGuageActFuct(void)
{
/*	TI_DTV_MENU_ITEM *pNextItem;
	switch (TiDTV_KeyBuf.CurKeyCodeMenu) {
		case TI_DTV_IR_KEY_UP:
				pNextItem = pCurDtvMenu->pCurItem->pUpItem;
				DtvDispSubMenuItem(pCurDtvMenu->pCurItem, SUB_MENU_CHARACTER_BACKCOLOR, SUB_MENU_CHARACTER_BACKCOLOR);
				pCurDtvMenu->pCurItem->(*InitFunc)(pCurDtvMenu->pCurItem);
				// Display the Cursor (current position)
				pCurDtvMenu->pCurItem = pNextItem;
				DtvDispSubMenuItem(pCurDtvMenu->pCurItem, SUB_MENU_CHARACTER_SEL_FRONTCOLOR, SUB_MENU_CHARACTER_SEL_FRONTCOLOR);
		
			if(gTIAudioSubMenuLevel == SUBMENU_FIRST_LEVEL)
			{
				pNextItem = pCurDtvMenu->pCurItem->pUpItem;
				if(pNextItem != NULL)
				{
					DtvAudioSelectItem(pNextItem);
				}
			       else
			       {
                     		// Erase the Cursor (previous position)
		                     DtvDispSubMenuItem(pCurDtvMenu->pCurItem, SUB_MENU_CHARACTER_BACKCOLOR, SUB_MENU_CHARACTER_BACKCOLOR);
                     		// Move to previous Menu
                     		pCurDtvMenu = pCurDtvMenu->pPrevMenu;
			       
			       }
					
			}
			
			break;
			
		case TI_DTV_IR_KEY_DOWN:
			if(gTIAudioSubMenuLevel == SUBMENU_FIRST_LEVEL)
			{
				pNextItem = pCurDtvMenu->pCurItem->pDownItem;
				DtvAudioSelectItem(pNextItem);
			
			}
			
			break;
			
		case TI_DTV_IR_KEY_LEFT:
		case TI_DTV_IR_KEY_RIGHT:
			if(gTIAudioSubMenuLevel == SUBMENU_FIRST_LEVEL)
			{
			        DtvAudioBarUpdate();
			
			}
			break;
		default:
			pNextItem = NULL;
			break;
			
	}

	
*/
	return 0;
}



/*******************************************************************************
*	@RoutineName:: TiDTV_DisplayMenuRadioBoxItemType
*
*	@Description:: display radio box node ralated info
*
*	@Input		:: TI_DTV_MENU_NODE * pMenuNode
*					
*	@Output		:: none
*
*	@Return	int	:: none
*******************************************************************************/


void TiDTV_DisplayMenuRadioBoxItemType(TI_DTV_MENU_ITEM *pMenuItem, USHORT * LeafArray, USHORT Position)
{
	USHORT  i, j, xPos, yPos;
	USHORT	RadioBoxGroupTotalNumber, RadioBoxGroupHeight, xPos_RadioBox, yPos_RadioBox ;
	USHORT  Bmp_Index;
	short	CurrentStringLength;




///////////////////////////////////////////////////////////////////		
// high light itself first
///////////////////////////////////////////////////////////////////
	
	// get leaf node numbers
	i = 0;
	
	while(LeafArray[i] != NULL)
	{
		i++;
	}

		// i means the total number of father's brothers
	RadioBoxGroupTotalNumber = i;
		// i means the total number of father's brothers
	RadioBoxGroupHeight = SUB_MENU_RADIOBOXITEM_HEIGHT * RadioBoxGroupTotalNumber;
		// current Y position 
	yPos =  pMenuItem->MsgY;
			
		// caculate first box item position
		// if father's Y position is at top half
	if((yPos + RadioBoxGroupHeight) < SUB_MENU_BOTTOMWITHOUTEDGE_YPOSITION)
	{
		yPos_RadioBox = yPos;
	}	
	else if((yPos - RadioBoxGroupHeight) > SUB_MENU_WITHOUTEDGE_YPOSITION) 
	{
		yPos_RadioBox = yPos - RadioBoxGroupHeight + SUB_MENU_RADIOBOXITEM_HEIGHT;
	}	
	else
	{
		yPos_RadioBox = SUB_MENU_CENTER_YPOSITION - RadioBoxGroupHeight/2;			
	}
	
	
	xPos_RadioBox = SUB_MENU_RADIOBOX_XPOSITION;

	yPos_RadioBox = yPos_RadioBox + SUB_MENU_RADIOBOXITEM_HEIGHT * Position; 

	xPos_RadioBox = SUB_MENU_RADIOBOX_XPOSITION;

	for(j = 0; j < SUB_MENU_RADIOBOX_HSTEP; j++)
	{
		if(j != 0)
		{
			xPos_RadioBox = xPos_RadioBox + SUB_MENU_RADIOBOX_STEP_LENGTH;
		}
		if(j == 0)
		{
			Bmp_Index = BMP_SELPOPUPLEFT;
		}
		else if(j == SUB_MENU_RADIOBOX_HSTEP - 1)
		{
			Bmp_Index = BMP_SELPOPUPRIGHT;
		}
		else
		{
			Bmp_Index = BMP_SELPOPUPCENTER;
		}		
		TiDTV_OsdMove(&TiDTV_OsdScreenMain, xPos_RadioBox, yPos_RadioBox);
		TiDTV_OsdDrawBitMap(&TiDTV_OsdScreenMain, Bmp_Index);
	}
			// should set char's style by attribute
	TiDTV_OsdSetCharColor(&TiDTV_OsdScreenMain, SUB_MENU_CHARACTER_UNSEL_FRONTCOLOR, 0);
			// draw title
	CurrentStringLength = (short)TiDTV_OsdGetStringLength(&TiDTV_OsdScreenMain, pCurDtvMsgBase[LeafArray[Position]]);
	xPos =  SUB_MENU_RADIOBOX_XPOSITION + SUB_MENU_RADIOBOX_LENGTH/2 - CurrentStringLength/2;
	TiDTV_OsdMove(&TiDTV_OsdScreenMain, xPos, yPos_RadioBox + 8);
	TiDTV_OsdDrawString(&TiDTV_OsdScreenMain, pCurDtvMsgBase[LeafArray[Position]]);
}


/*******************************************************************************
*	@RoutineName:: TiDTV_RestoreMenuRadioBoxItemType
*
*	@Description:: display radio box node ralated info
*
*	@Input		:: TI_DTV_MENU_NODE * pMenuNode
*					
*	@Output		:: none
*
*	@Return	int	:: none
*******************************************************************************/


void TiDTV_RestoreMenuRadioBoxItemType(TI_DTV_MENU_ITEM *pMenuItem, USHORT * LeafArray, USHORT Position)
{
	USHORT  i, j, xPos, yPos;
	USHORT	RadioBoxGroupTotalNumber, RadioBoxGroupHeight, xPos_RadioBox, yPos_RadioBox ;
	USHORT  Bmp_Index;
	short	CurrentStringLength;




///////////////////////////////////////////////////////////////////		
// high light itself first
///////////////////////////////////////////////////////////////////
	
	// get leaf node numbers
	i = 0;
	
	while(LeafArray[i] != NULL)
	{
		i++;
	}

		// i means the total number of father's brothers
	RadioBoxGroupTotalNumber = i;
		// i means the total number of father's brothers
	RadioBoxGroupHeight = SUB_MENU_RADIOBOXITEM_HEIGHT * RadioBoxGroupTotalNumber;
		// current Y position 
	yPos =  pMenuItem->MsgY;
			
		// caculate first box item position
		// if father's Y position is at top half
	if((yPos + RadioBoxGroupHeight) < SUB_MENU_BOTTOMWITHOUTEDGE_YPOSITION)
	{
		yPos_RadioBox = yPos;
	}	
	else if((yPos - RadioBoxGroupHeight) > SUB_MENU_WITHOUTEDGE_YPOSITION) 
	{
		yPos_RadioBox = yPos - RadioBoxGroupHeight + SUB_MENU_RADIOBOXITEM_HEIGHT;
	}	
	else
	{
		yPos_RadioBox = SUB_MENU_CENTER_YPOSITION - RadioBoxGroupHeight/2;			
	}
	
	

⌨️ 快捷键说明

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