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

📄 osd_util.c

📁 SAMSUNG 5009的源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
/******************************************************************************
 *   Filename    : OSD_Util.c
 *   Start       : 2003. 10. 2
 *   By          : Hongsik Park
 *   Contact     : hongsik7.park@samsung.com
 *   Description : 
 *		Common codes are palced here from OSD_work.c  for MMN support
 *
 ******************************************************************************
 */

/******************************************************
 *       INCLUDES
 *****************************************************/
#include <string.h>
#include <stdio.h>
#include "Basic_typedefs.h"
#include "CUSTOM/Custom_option.h"
#include "OS/OS_abstract.h"
#include "API/SH_types.h"
#include "API/SH_api.h"

#include "COMMON/Common.h"

#include "MAIN/Global_state.h"
#include "MAIN/Appl_types.h"
#include "MAIN/Uop_msg.h"

#include "CUSTOM/Osd_types.h"
#include "CUSTOM/Osd_if.h"

#include "CUSTOM/Key_handler_setup.h"
#include "CUSTOM/Key_defs.h"

#include "MAIN/DVD/Dvd_predef.h"
#include "MAIN/DVD/Dvd_common.h"
#include "MAIN/MMP/Mmp_common.h"

#include "MAIN/SVCD/Svcd_types.h"
#include "MAIN/SVCD/Svcd_ext.h"
#include "MAIN/SVCD/Svcd_show.h"

#include "./Osd_util.h"
#include "./Osd_data.h"
#include "./Osd_draw.h"
#include "./Osd_timer.h"		//(weilf)20060726
#include "CUSTOM/Strings_ext.h"

#define CHAR_GAP	1/* null character gap */

extern BOOL 		gOsd_onoff;
extern ONOFF		gOsd_angle_onoff;
extern volatile BOOL	gScreen_saver_on; // Qian liping 060418

/******************************************************************************
 *   GLOBALS                                                                  
 ******************************************************************************/
BOOL			gRedraw_flag = FALSE;

BYTE1 gFont_index = 0;

extern BOOL IsResumeStopState( VOID );		//(weilf)20060726
extern BOOL MIX_SetGraphicPos(BYTE1 gfx_obj, USHORT x_pos, USHORT y_pos);		//(weilf)20060726
extern INLINE VOID SetDisplayInfoSub( OSD_InfoSubState_et  type );			//(weilf)20060726
extern INLINE IconState_et GetDisplayIconState( VOID );					//(weilf)20060726
extern INLINE IconState_et GetDisplayIconState( VOID );					//(weilf)20060726
#if _APP_CAP_AUD_FUNCTION_KEY
extern INLINE void SetDisplayVolOsdTypeState( VolOsdType_et  type );		//(weilf)20060726
#endif
extern INLINE OSD_MainType_et GetDisplayMainState( VOID );				//(weilf)20060726

/******************************************************************************
* Function name	: OwSetTxtInCenterSimple 
* Arguments		:  
*     IN    			OSD_Rectangle_st *wnd_bg, OSD_Rectangle_st *wnd,char * str
*			
*     OUT       			
*     I/O       
* Return			:  VOID
*			
* By				: 
* Description		: 
* Revision		:  V1.0
******************************************************************************
*/
VOID OwSetTxtInCenterSimple( OSD_Rectangle_st *wnd_bg, OSD_Rectangle_st *wnd,char * str)
{	
	BYTE2 str_width;
	SINT x_offset;

	SH_GfxGetStrSize(str, &str_width, NULL);
	
	wnd->width = str_width ;
	x_offset = ( wnd_bg->width - wnd->width) /2 ;
	if( x_offset < 0)
		return;
	else
		wnd->x_pos = wnd_bg->x_pos+ x_offset ;

}

/******************************************************************************
* Function name	: OwGetStrCenterPos 
* Arguments		:  
*     IN    			CHAR* str, BYTE2 width, BYTE2 height
*			
*     OUT       			BYTE2 *x_pos, BYTE2 *y_pos 
*     I/O       
* Return			:  BOOL
*			
* By				: Kim Do Yeon
* Description		: Get the string center position in pixel unit
* Revision		:  V1.0
******************************************************************************
*/
BOOL OwGetStrCenterPos(CHAR* str, BYTE2 width, BYTE2 height, BYTE2 *x_pos, BYTE2 *y_pos )
{
	BYTE2 str_width, str_height;	
	
	if(SH_GfxGetStrSize(str, &str_width, &str_height))
	{
		if((width < str_width) ||(height < str_height))
			return FALSE;
		
		*x_pos = (width - str_width)/2;
		*y_pos = (height - str_height)/2;		
	}
	else
	{
		return FALSE;
	}	

	return TRUE;
}

/******************************************************************************
* Function name	: OwGetOsdCenterPosY 
* Arguments		:  
*     IN    			
*			
*     OUT       			BYTE2 *y_pos 
*     I/O       
* Return			:  BOOL
*			
* By				: Kim Do Yeon
* Description		: Get the osd center Y position in the current TV display
* Revision		:  V1.0
******************************************************************************
*/
BOOL OwGetOsdCenterPosY(BYTE2 *y_pos)
{
	BYTE2 max_w, max_h;
	
	SH_GfxGetTvMaxDisSize(&max_w, &max_h);

	(*y_pos) *= ((max_h)/480);	

	return TRUE;
}
/******************************************************************************
* Function name	: OwGetOsdCenterPosition
* Arguments		:  
*     IN    			
*			
*     OUT       			BYTE2 *y_pos 
*     I/O       
* Return			:  BOOL
*			
* By				: Qian liping 060420
* Description		: Get the osd center position in the current TV display
* Revision		:  V1.0
******************************************************************************
*/
BOOL OwGetOsdCenterPosition( BYTE2 *x_pos,BYTE2 *y_pos, BYTE2 width, BYTE2 height )
{
	S5H_OutputTvMode_t 	tv_type;

	tv_type = S5H_GetOutputTvMode();
	
	if( tv_type == OUTPUT_525_60 )// NTSC mode
	{
		(*y_pos)=(SSHORT)(480-height)/2 ;	
	}
	else
	{
		(*y_pos)=(SSHORT)(576-height)/2 ;
	}
	
	(*x_pos) =(SSHORT)(720-width)/2;
	
	return TRUE;
}

  /******************************************************************************
* Function name  :  OwUpdateStr
* Arguments      :  
*     IN           char * gStr ,char* string,BYTE2 x,BYTE2 y,BYTE2 w,BYTE2 h
*					
*     OUT       
* Return         :  
*					VOID
* By             : 	Chang Lina 060116
* Description    :  partial update time  string display 
					(all dvd and vcd time info display)
* Revision       :  V1.0
******************************************************************************
*/
VOID OwUpdateStr(char * gStr ,char* string,BYTE2 x,BYTE2 y,BYTE2 w,BYTE2 h) 
{
	UCHAR code;
	UINT i, str_len = 0, skip_width = 0;
	
	str_len = strlen(string);

	/* compare with the previous string(gStr) */
	for(i=0; i<str_len; i++)
	{
		if(string[i] != gStr[i] ) 			
			break;
	}

	/* Get the same string width */	
	for(str_len=0; str_len< i; str_len++)
	{
		code = (int) string[str_len];
		skip_width +=( gGfx_font_pos_info[code].width); 
	}

	/* Draw only the diffent part */
 	strcpy((char*)gStr,(char*)(string+i));
	SH_GfxDrawRec(SH_CANV1,	x+skip_width,	y-2,	w-skip_width,	h,	OSD_COLOR_TRANS_BG); 	
	SH_GfxDrawStr(SH_CANV1, (char*)gStr, 	x+skip_width, 	y, NULL);

	strcpy((char*)gStr,(char*)string);	
	
}

/******************************************************************************
* Function name  :  OwSetValidNumberStringFormat
* Arguments      :  
*     IN        
*					VOID
*     OUT       
*     I/O       
* Return         :  
*					VOID
* By             : 		Qian liping 050810
* Description    :  		Set num-string format 
* Revision       :  
******************************************************************************
*/
VOID OwSetValidNumberStringFormat(CHAR *str,  UINT input_num)
{
	UCHAR num_dig=0;
	UINT temp;
	
	temp = input_num;

	while (temp )
	{
		temp /= 10;
		num_dig ++;
	}
	
	switch( num_dig)
	{
		case 0:
		case 1:
			sprintf( (char*)str, "%001d", input_num);
			break;

		case 2:
			sprintf( (char*)str, "%002d", input_num);
			break;

		case 3:
			sprintf( (char*)str, "%003d", input_num);
			break;

		case 4:
			sprintf( (char*)str, "%004d", input_num);
			break;

		case 5:
			sprintf( (char*)str, "%005d", input_num);
			break;

		case 6:
			 sprintf( (char*)str, "%006d", input_num);
			break;
	}	
	
}

/******************************************************************************
 * Function name  : OwSetVisibleString 
 * Arguments      :  
 *     IN        
 *			UCHAR * string
 *     OUT       
 *     I/O       
 * Return         :  
 *			VOID
 * By             : Kim Do Yeon
 * Description    :  
 * Revision       :  
 ******************************************************************************
 */
VOID OwSetVisibleString(UCHAR * string)
{
	int i = 0;
	int j = 0;
	UCHAR code;    

	while((code = *(string + i))  != '\0'){    

	    if((code >=0x30 && code <= 0x39) ||	/* number */
	        (code >= 0x41 && code <= 0x5A) ||	/* upper case alphabet */
	        (code >= 0x61 && code <= 0x7A) ||	/* lower case alphabet */
	        (code == 0x20) ||				/* null */
	        (code == 0x2F) ||				/* "/" */
	        (code == 0x2E) ||				/* "." */
	        (code == 0x2D) ||				/* "-" */               
	        (code == 0x5F)					/* "_" */

	        )
	    {

			*(string + j) = code; /* Set the character as it is */

	    }
#if 0	    
	    else if ( code >= 0x80 )/* is unicode? (maybe --;) */
	    {

	        *(string + j) = 0x2A;
			
			/* <<< @: 5008CHN-XXX.Gaoping 050712:  MMN: when file name has chinese word , and name lenth is limited ,"." will be part of chinese word , not display  */
			if (*(string + i+1)!=0x2E )//detect "."
			/* <<< @: 5008CHN-XXX.Gaoping 050712:  MMN:  */
			i++;                   /* skip 1 charater */

			if (*(string + i)  == '\0')	/* After skipping a character check if Null character is there next ..*/
			{
				j++;
				break;
			}
	    }
#endif	    
	    else
	    {
	        *(string + j) = 0x2A; /* Fill with the "*" character */
	    } 

	    j++;    
	    i++;                

	} /* while */        

	*(string + j) = 0x00;

}

#if _USE_5010||_USE_5009		//(weilf)20060408
/******************************************************************************
 * Function name  : OwSetSmiVisibleString 
 * Arguments      :  
 *     IN        
 *			UCHAR * string
 *     OUT       
 *     I/O       
 * Return         :  
 *			VOID
 * By             : Weilifeng
 * Description    :  
 * Revision       :  
 ******************************************************************************
 */
VOID OwSetSmiVisibleString(CHAR * string)		//(weilf)20060726
{
	int i = 0;
	int j = 0;
	CHAR code;    

	while((code = *(string + i))  != '\0'){    

#if _APP_CAP_OSD_LANG_CHINESE_SUBTITLE		//(weilf)20060707
	    if( ((code >= 0x80&&code <= 0xaf)&&code != 0xa3&&code != 0xa1) ||(code >= 0xd8&&code <= 0xff) )	//(weilf)20060518
	    {
	        *(string + j) = 0x2A; 		/*unknown, fill with the "*" character */
		i++;
	    } 
	    else if(code <= 0x7F)
	    {
			*(string + j) = code; 	/* Set the character as it is */
	    }
	    else if((code >= 0xb0&&code <= 0xd7)||code == 0xa3||code == 0xa1)			//(weilf)20060518
	    {
			*(string + j) = code; 	/* chinese 1nd character Set the character as it is */
			i++;
			j++;
			*(string + j) = *(string + i);	/* chinese 2nd character Set the character as it is */
	    }	
		
	    j++;    
	    i++;                
#else		
	if(code <= 0x7F)
	{
		*(string + j) = code;
	}
	else 
	{
		*(string + j) = 0x2A;		/*fill the "*" character*/
	}
	    j++;    
	    i++;        
#endif

	} /* while */        

	*(string + j) = 0x00;

}
#endif	//_USE_5010||_USE_5009	

/******************************************************************************
 *  Function name 	: GuiCDDAInfoCheck
 *  Arguments     	: 
 *  Return        	: BOOL
 *  By            		: Qian liping 060404 
 *  Description   	:  
 ******************************************************************************
 */
VOID GuiCDDAInfoCheck(VOID)
{
	if (GetDiscState() == CD_DA && GetMixedCdState() == FALSE)
	{
		OSD_SetMainDisplay(DISPLAY_INFO, SYS_NO_WAIT );
	}
}

/******************************************************************************
 *  Function name : OsdDoOff
 *  Arguments     : 
 *       IN         
 *       OUT
 *       INOUT
 *  Return        : VOID
 *  By            : Taejin Kwon
 *  Description   : Qian liping 060418
 ******************************************************************************
 */
VOID OsdDoOff( VOID )
{
	DiscType_t	disc = GetDiscState();
	S5H_App_t 	app = S5H_GetAppType();
	if( gOSD_state.etCur_dsp == DISPLAY_OFF )
		return;

	/* IF Pre display is SETUP menu */
	if( gOSD_state.etCur_dsp == DISPLAY_SETUP )
	{
		OSD_MenuCtrl_st	menu;
		
		menu.depth = MENU_DOM_DEPTH_0;
		menu.d1_list = MENU_D1_SUB_LANG;
		menu.d2_list = MENU_D2_LANG_OSDMENU;
		menu.d3_list = LANG_AUTO;
		menu.d4_list = OTH_LANG_CESKY;
		menu.pass_step = PASSWD_SUB_NONE;
		memcpy(&gOSD_state.etSetup_dsp, &menu, sizeof(OSD_MenuCtrl_st));

#if _HJL_NEW_SETUP_SCHEME
	DeleteSetupAllNode();
#endif
	}	
	 // Qian liping 060116
	if( gOSD_state.etCur_dsp == DISPLAY_INFO )
	{
		gOSD_state.etInfo_dsp = INFO_OFF;
	}


	if( (gOSD_state.etCur_dsp == DISPLAY_SETUP
#if _APP_CAP_FUNC_COLDSTART
		|| gOSD_state.etCur_dsp == DISPLAY_COLDSTART
#endif
		) && 
		(GetMainState() == MAIN_STOP || GetMainState() == MAIN_LEADIN || GetMainState() == MAIN_OPEN) )

⌨️ 快捷键说明

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