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

📄 periphgui.c

📁 Sunplus 8202S source code.
💻 C
📖 第 1 页 / 共 5 页
字号:
                case COPY_EXISTING://copy to existing dir
                	card_copy(COPY_EXISTING);
        			break;    
                case COPY_NEWDIR://copy to created new folder
				    card_copy(COPY_NEWDIR);
        			break;                
            }
        }
        else if(KeyID == BUTTON_RENAME)//rename the selected file
        {
            	rename_cardfile();        
        }
      
}
void input_str_clear_variable(void)
{
    int i;
    for(i=0;i<8;i++)
       GetString[i]=' ';
    Str_Index_x=0;
    Str_Index_y=0;
    Exit_Enter_flag=0;
    Max_input_flag=0;
    Max_left_flag=0;
    input_xoffset=0;    
}
#endif

/***************************************************************************
 *  Function Name: input_page                                              *
 *  Purposes:  draw the input page after select                            * 
 *             "copy to new dir/existing dir"                              *
 *  Arguments: none                                                        *
 *  Returns:   none                                                        *
 *  Update:    sunzhh 2004-11-10                                           *
 **************************************************************************/
void input_page(void)
{
    #ifdef NEW_INPUT_MENU   
    BYTE *title_str1="INPUT DIR:";
    BYTE *title_str2="INPUT NAME:";
    osd_init_periphGUI();
    osd_draw_region_rect(0, 0, 64*8, 40, COLOR_GREEN, 3);
    osd_draw_region_rect(0, 278, 64*8, 10, COLOR_GREEN, 3);
    if(KeyID == BUTTON_COPY)
	    osd_DrawRegionString(2, 1, title_str1, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION);		
    else if(KeyID == BUTTON_RENAME)
	    osd_DrawRegionString(2, 1, title_str2, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION);		

    osd_DrawRegionString(14+xoffset, 1, " ", COLOR_DBLUE,COLOR_LBLUE, FUNCTION_REGION);
	SetOsdCol(FUNCTION_REGION, FUNCTION_REGION, 0,__palette4F(192,192, 192, 0xe0));		//draw background of the region
    //init variable
    input_str_clear_variable();
    input_str_clear_HL();
    //HL first itemstr
    input_HL_ItemStr(0);
    //for IR U/D/L/R/Sel input str func setting
    SetFullscrnCmdFuncPtr(input_str_func_up, input_str_func_down, input_str_func_left,
                                  input_str_func_right, input_str_func_select);
    #else  
    int i;
    BYTE *str[]={   "      INSTRUCTION       ",
                    "1->1 A B C    2->2 D E F",
                    "3->3 G H I    4->4 J K L",
                    "5->5 M N O    6->6 P Q R",
                    "7->7 S T U    8->8 V W X",
                    "9->9 Y Z ~    0->0 _ - \\",
                    "<: CANCEL     >: SPACE"};
    BYTE *title_str1="INPUT DIR:";
    BYTE *title_str2="INPUT NAME:";
    input_flag=1;
    osd_init_periphGUI();
    osd_draw_region_rect(0, 0, 64*8, 40, COLOR_GREEN, 3);
    osd_draw_region_rect(0, 278, 64*8, 10, COLOR_GREEN, 3);
    if(KeyID == BUTTON_COPY)
	    osd_DrawRegionString(2, 1, title_str1, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION);		
    else if(KeyID == BUTTON_RENAME)
	    osd_DrawRegionString(2, 1, title_str2, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION);		

    osd_DrawRegionString(14+xoffset, 1, " ", COLOR_DBLUE,COLOR_LBLUE, FUNCTION_REGION);
	SetOsdCol(FUNCTION_REGION, FUNCTION_REGION, 0,__palette4F(192,192, 192, 0xe0));		//draw background of the region
    for(i=0;i<=6;i++)
    osd_DrawRegionString(4, (i+1)*8+5, str[i], COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION);	
    #endif
}
#ifdef NEW_INPUT_MENU
void input_str_clear_HL(void)
{
    int i;
    BYTE *str[]={   " A  B  C  D  E  F  G  H ",
                    " I  J  K  L  M  N  O  P ",
                    " Q  R  S  T  U  V  W  X ",
                    " Y  Z  1  2  3  4  5  6 ",
                    " 7  8  9  0  ~  _  -  \\",
                    "                        ",                    
                    "    EXIT        ENTER   "};
   for(i=0;i<=6;i++)
   osd_DrawRegionString(4, (i+1)*8+5, str[i], COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION);                     
}            
void input_HL_ItemStr(BYTE itemstr_index )
{
    BYTE itemstr_xstart = 0;
    BYTE itemstr_ystart = 0;
    BYTE x,y;   
    x=itemstr_index%8;
    y=itemstr_index/8;
    itemstr_xstart =5 + x*3;
    itemstr_ystart =13+ y*8;
    osd_DrawRegionString(itemstr_xstart, itemstr_ystart,Item_Str[itemstr_index], COLOR_WHITE, COLOR_DBLUE,FUNCTION_REGION);      
    
}

#endif

/***************************************************************************
 *  Function Name: input_name                                              *
 *  Purposes:  show the input letter on the input page                     * 
 *  Arguments: none                                                        *
 *  Returns:   none                                                        *
 *  Update:    sunzhh 2004-11-10                                           *
 **************************************************************************/
void input_name(int num)
{
    BYTE *namestring[10][4]={ 
                            {"0","_","-","\\"},
                            {"1","A","B","C"},
                            {"2","D","E","F"},
                            {"3","G","H","I"},
                            {"4","J","K","L"},
                            {"5","M","N","O"},
                            {"6","P","Q","R"},
                            {"7","S","T","U"},
                            {"8","V","W","X"},
                            {"9","Y","Z","~"}};
    if(pressnum_flag!=1)
    {        
               
    if(pressnum!=num)
    {
        PressID=0;
        pressnum=num;
    }
    else
    {
        if(PressID>=3)
            PressID=0;  
        else
            PressID++;  
    }   

    osd_DrawRegionString(14+xoffset, 1, namestring[num][PressID], COLOR_DBLUE,COLOR_LBLUE, FUNCTION_REGION);
    temp=namestring[num][PressID];
    //printf("temp=%c\n",*temp);
}
}
/***************************************************************************
 *  Function Name: polling_input_name                                      *
 *  Purposes:  called by polling_100ms in polling.c to                     * 
 *             refresh the letter inputted                                 *
 *  Arguments: none                                                        *
 *  Returns:   none                                                        *
 *  Update:    wangw 2004-11-10                                            * 
 **************************************************************************/
void polling_input_name(void)
{
    static BYTE i=0;
    static BYTE temp1=50,temp2=50;
    if((i==0)&&(pressnum!=10))
    {
        temp1=pressnum;
        temp2=PressID;
        i++;
    }
    else
    {
        if((pressnum!=temp1)||(PressID!=temp2))
        {
            i=0;   
        }
        else
        {
            if((i==10))
            {   
                if((pressnum==temp1)&&(PressID==temp2))
                {

                        getstring[xoffset]=*temp;
                        osd_DrawRegionString(14+xoffset, 1, temp, COLOR_DBLUE,COLOR_GREEN, FUNCTION_REGION); 
                        xoffset++;
                        if(xoffset>7)
                        {
                             pressnum_flag=1;    
                             xoffset=7;
                        }
                       
                        osd_DrawRegionString(14+xoffset, 1, " ", COLOR_DBLUE,COLOR_LBLUE , FUNCTION_REGION);
                }
                i=0;
                pressnum=10;
            }
            else
                i++;
        }
    }
}
/***************************************************************************
 *  Function Name: card_copy                                               *
 *  Purposes:  the entry of coping file from                               * 
 *             cdrom to card/USB and showing related GUI                   *
 *  Arguments: copy_mode                                                        *
 *  Returns:   none                                                        *
 *  Update:    wangw 2004-11-10                                            * 
 **************************************************************************/
void card_copy(BYTE copy_mode)
{
    #ifdef SPHE8202_ALL_TYPE_CARD_WRITE
    card_browse_sign = 0;
    CardTestReady();
    play_state=VCD_STATE_NORMAL;
    card_browse_sign = 1;
    #endif
	
	int copy_status;
#ifdef CF_CARD_WRITE
//	if(CardIdentify()!=0)//very important!!!
	if(FSIdentify()!=0)//very important!!!
#else
    if(!CARDIsPlugIn())
#endif
	{
	    
		Message_Show(ERROR_MESSAGE);
		show_switch(Select_Media);
	}
	else
	{
		if(pFsJpeg->gifsFuncBtn == FS_FUNC_MP3)
		{
			sign_PFun=PFUN_WRITE;//write cf card
			AVD_SetMediaInterrupt();//stop the current mp3, Can't be used for JPEG!!
			Message_Show(PFUN_COPYING);

		}
		else if(pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)
		{
			sign_PFun=PFUN_WRITE;//write JPEG
			Message_Show(PFUN_COPYING);
//			copy_status=CardSchedule(copy_mode);
			copy_status=FSSchedule(copy_mode);
			StorageWriteMessageShow(copy_status);
			full_scrn &= (~PERIPHERAL);//for release the IR
			osd_init();
			#ifdef NEW_INPUT_GUI
			input_str_clear_variable();
			#endif
		}
		#ifdef FAT_Write_File_System  //added by wangwei,2004-11-5 15:42(for other media,eg:mp4,dat...)
		else if(pFsJpeg->gifsFuncBtn == FS_FUNC_OTHER)
        {
            sign_PFun=PFUN_WRITE;//write JPEG
			Message_Show(PFUN_COPYING);
//			copy_status=CardSchedule(copy_mode);
			copy_status=FSSchedule(copy_mode);
			StorageWriteMessageShow(copy_status);
			full_scrn &= (~PERIPHERAL);//for release the IR
			osd_init();
			#ifdef NEW_INPUT_GUI
			input_str_clear_variable();
			#endif
        }
        #endif  //FAT_Write_File_System
	}
}
/********************************************************************************\
**Function      : StorageWriteMessageShow()
**Description   : show message
**Return value  : null
**Creator       : lijd 2004-12-8 17:21
\********************************************************************************/
void StorageWriteMessageShow(int copy_status)
{
    switch(copy_status)
    {
        case -1:
                Message_Show(P_SPACEFULL);
                break;
        case -2:
                Message_Show(P_NOMATCH);
                break;
        case -3:
                Message_Show(P_DIREXISTING);
                break;
        case -4:
                Message_Show(P_UDISK_PROTECT);	
                break; 
        case -5:
                Message_Show(P_UDISK_PLUGOUT);	
                break;
        case -6:
                Message_Show(P_DIT_EXIST);	
                break;
        case -7:
                
                break;
        default:
                Message_Show(PFUN_WRITE);
                break;                                               
    }
    
}
/***************************************************************************
 *  Function Name: cd2card                                                 *
 *  Purposes: the entry of changing playing cdrom to card/USB              *
 *  Arguments: none                                                        *
 *  Returns: none                                                          *
 **************************************************************************/
void cd2card(void)
{
	read_card_sign=1;	//fengjl 2004-07-06 11:03
    SwitchMedia(CD2CARD);
}
/***************************************************************************
 *  Function Name: card2cd                                                 *
 *  Purposes: the entry of changing playing card/USB to cdrom              *
 *  Arguments: none                                                        *
 *  Returns: none                                                          *
 **************************************************************************/
void card2cd(void)
{
    SwitchMedia(CARD2CD);

}
/***************************************************************************
 *  Function Name: card_delete                                             *
 *  Purposes: the entry of deleting the selected file                      *
 *  Arguments: none                                                        *
 *  Returns: none                                                          *
 **************************************************************************/
int card_delete(void)
{
#ifdef CF_CARD_WRITE
//	if(CardIdentify()!=0)//very important!!!
	if(FSIdentify()!=0)//very important!!!
#else
    if(!CARDIsPlugIn())
#endif
	{
		Message_Show(ERROR_MESSAGE);
		show_switch(Select_Media);
	}
	else
	{
		sign_PFun=PFUN_DELETE;//delete data
//		if(CardSchedule(0)==-1)
		if(FSSchedule(0)==-1)

⌨️ 快捷键说明

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