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

📄 fsgui_bmpui.c

📁 dvd里面的一个文件系统的代码
💻 C
📖 第 1 页 / 共 3 页
字号:
//    return;

    //decide the backgroud line of the button,
    //according to which state it is, highlighted,pressed or normal
    switch(state)
    {
        case HL_STATE:
            uiBgIndex = LAY_TAB_BAR_SHINE;
            uiBgYPos = BTN_BG_HL_YPOS;
            break;
        case DOWN_STATE:
            uiBgIndex = LAY_TAB_BAR_DOWN;
            uiBgYPos = BTN_BG_DOWN_YPOS;
            break;
        case UP_STATE:
            uiBgIndex = LAY_TAB_BAR2_2;
            uiBgYPos = BTN_BG_UP_YPOS;
            break;
    }      
    pBgLayout = &g_aBitmapLayout[uiBgIndex];
    
    //decide the backgroud x y pos and icon on the button, 
    //according to which type it represents, mp3,jpg,vide,or game.
    switch(type)
    {
        case FS_FUNC_MP3:
            uiIcnIndex = LAY_MP3_ICON_L;
            uiBgXPos = MP3_BTN_BG_XPOS;
            break;
        case FS_FUNC_JPEG:
            uiIcnIndex = LAY_JPG_ICON_L;
            uiBgXPos = MP3_BTN_BG_XPOS + (FS_FUNC_JPEG - FS_FUNC_MP3) * BTN_BG_XOFFSET;
            break;
#if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
        case FS_FUNC_GAME:
            uiIcnIndex = LAY_GAME_ICON_L;
            uiBgXPos = MP3_BTN_BG_XPOS + (FS_FUNC_GAME - FS_FUNC_MP3) * BTN_BG_XOFFSET;
            break;
#endif //#ifdef SUPPORT_NESGAME
            
#ifdef SUPPORT_FILE_SYSTEM_MODE
        case FS_FUNC_OTHER:
            uiIcnIndex = LAY_VIDEO_ICON_L;
            uiBgXPos = MP3_BTN_BG_XPOS + (FS_FUNC_OTHER - FS_FUNC_MP3) * BTN_BG_XOFFSET;
            break;
#endif //#ifdef SUPPORT_FILE_SYSTEM_MODE
#ifdef SUPPORT_MIDI
	    case FS_FUNC_MIDI:
	        break;
#endif	    
    }//end switch(type)

    //draw the backgroud line and layout the icon
    FSGUI_DrawBackGround(uiBgXPos, uiBgYPos, 
    		   pBgLayout->uiXRepeat, pBgLayout->uiYRepeat,
                 uiBgIndex); //draw the backgroud
          

    FSGUI_LayoutBmp(uiIcnIndex);//layout the icon
    
}//end FSGUI_DrawOneButton

/*
 * Description:
 *      Draw a rect with four corner,including dir scroll and fiel scroll background
 * Note:
 *      use 10 section pic to draw file and dir background
 * 
 * INPUT:
 *      xStart  -->  the background x start position
 *      yStart  -->  the background y start position
 *      iWidth  -->  width of background
 *      iHeight -->  height of background
 *
 * Creator:  suqiaoli
 *
 * Data:2004-6-10 
 *
 */
void FSGUI_ShowBmpCornerRect(UINT16 xStart, UINT16 yStart,UINT16 iWidth, UINT16 iHeight)
{
    int i = 0;
    int xRepeat = 0;
    int yRepeat = 0;
    
    #define HLINE_WIDTH         22
    #define HLINE_HEIGHT        2
    #define VLINE_WIDTH         2
    #define VLINE_HEIGHT        259
    
    xRepeat = iWidth/RECT_BG_BMP_WIDTH;
    yRepeat = iHeight/RECT_BG_BMP_HEIGHT;
   
    //----Draw left line and right line
    
    //draw background with file_bg.bmp//frank.huang 050915 edit
    FSGUI_DrawBackGround(xStart,yStart,xRepeat,yRepeat,LAY_FILE_BG_10_0);//first section
    for (i = 0; i < PER_PAGE; i ++)//8 sections
    {
        FSGUI_DrawBackGround(xStart,yStart + 12 + FS_FILELIST_YSTEP * i ,xRepeat,yRepeat,LAY_FILE_BG_10_1 + i );
    }

    
    //-----DrawScroll
    //Draw 4 horizonal lines
    #ifdef	GPS_MP3_UI//frank.huang 050923
	FrameBuf_DrawLine(xStart - 2 , yStart + 10 , 2, iHeight+8, RECTLINE_Y,RECTLINE_CRCB );
    FrameBuf_DrawLine(xStart + DIR_AREA_XLEN , yStart + 10, 2, iHeight+8, RECTLINE_Y,RECTLINE_CRCB );
	FSGUI_DrawBackGround(xStart+2 ,yStart + 12 + iHeight ,xRepeat,yRepeat,LAY_FILE_BG_10_9);//last section
	FSGUI_LayPosVariableBmp(xStart - 2, yStart,LAY_FILE_BG_CORNER_LT);//LT
    FSGUI_LayPosVariableBmp(xStart + iWidth - 27 , yStart,LAY_FILE_BG_CORNER_RT);//RT
	FSGUI_LayPosVariableBmp(xStart - 2, yStart + iHeight+ 12,LAY_FILE_BG_CORNER_LB);//LB
    FSGUI_LayPosVariableBmp(xStart + iWidth - 27 , yStart + iHeight+ 9 ,LAY_FILE_BG_CORNER_RB);//RB
    FSGUI_DrawBackGround(xStart + iWidth - 27, yStart + 13, 1,32*PER_PAGE,SLIDER_BODY);

	FSGUI_LayPosVariableBmp(xStart + iWidth - 21 , yStart + 9 ,ARROW_U);//RB
	FSGUI_LayPosVariableBmp(xStart + iWidth - 21 , yStart + iHeight-5 ,ARROW_D);//RB
	
	#else//#ifdef	GPS_MP3_UI
	FrameBuf_DrawLine(xStart - 2 , yStart + 10 , 2, FILE_AREA_XLEN + 2, RECTLINE_Y,RECTLINE_CRCB );
    FrameBuf_DrawLine(xStart + DIR_AREA_XLEN , yStart + 10, 2, FILE_AREA_XLEN + 2, RECTLINE_Y,RECTLINE_CRCB );
    
    FSGUI_DrawBackGround(xStart ,yStart + 12 + FS_FILELIST_YSTEP * PER_PAGE ,xRepeat,yRepeat,LAY_FILE_BG_10_9);//last section
    //Draw four corner
    FSGUI_LayPosVariableBmp(xStart - 2, yStart,LAY_FILE_BG_CORNER_LT);//LT
    FSGUI_LayPosVariableBmp(xStart + iWidth - 8 , yStart,LAY_FILE_BG_CORNER_RT);//RT
    FSGUI_LayPosVariableBmp(xStart - 2, yStart + iWidth + 8,LAY_FILE_BG_CORNER_LB);//LB
    FSGUI_LayPosVariableBmp(xStart + iWidth - 8 , yStart + iWidth + 8 ,LAY_FILE_BG_CORNER_RB);//RB
    //-----DrawScroll
    //Draw 4 horizonal lines
    FrameBuf_DrawLine(xStart + DIR_AREA_XLEN + 2 , yStart + 10 ,  HLINE_WIDTH, HLINE_HEIGHT, RECTSCROLL_LINE_Y,RECTSCROLL_LINE_CRCB );
    FrameBuf_DrawLine(xStart + DIR_AREA_XLEN + 2, yStart + 32 ,  HLINE_WIDTH, HLINE_HEIGHT, RECTSCROLL_LINE_Y,RECTSCROLL_LINE_CRCB );
    FrameBuf_DrawLine(xStart + DIR_AREA_XLEN + 2, yStart + DIR_AREA_YLEN - 34 , HLINE_WIDTH, HLINE_HEIGHT, RECTSCROLL_LINE_Y,RECTSCROLL_LINE_CRCB );
    FrameBuf_DrawLine(xStart + DIR_AREA_XLEN + 2, yStart + DIR_AREA_YLEN - 12 , HLINE_WIDTH, HLINE_HEIGHT, RECTSCROLL_LINE_Y,RECTSCROLL_LINE_CRCB );
    
    //draw 1 vertical line
    FrameBuf_DrawLine(xStart + DIR_AREA_XLEN + 24 , yStart + 10 , VLINE_WIDTH, VLINE_HEIGHT, RECTSCROLL_LINE_Y,RECTSCROLL_LINE_CRCB );
    
    //draw 2 arrows
    DrawTriangle(xStart + DIR_AREA_XLEN + 8 , yStart + 23, 12, 6, 1, UPARROW_Y, UPARROW_CRCB); 
    DrawTriangle(xStart + DIR_AREA_XLEN + 8 , yStart + DIR_AREA_YLEN - 23 , 12, 6, 0, DOWNARROW_Y, DOWNARROW_CRCB); 
    #endif//#ifdef	GPS_MP3_UI
    
}

/*
 * FUNC : Clear the item in Rectangle with four corner.
 *        Main for:file icon,dir icon,file item,dir item.
 * 
 * INPUT:
 *        iIndex :   Area index.
 *        iItem  :   if iItem >= PER_PAGE, it means clear all items or dir icons ;
 *                   if iItem <  PER_PAGE, it means clear current item
 * Creator: Suqiaoli
 * Date: 2004-6-10
 */

void FSGUI_ClearArea(UINT16 iIndex,UINT16 iItem)
{
    int i;
    
    if ((pFsJpeg->gifsState == FS_STATE_JPEG) && (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG))
		return;
	
	//clear current file icon;
	if ((iIndex == FS_AREA_FILEICON) && (refresh_file_page==0))
	{
		FSGUI_DrawBackGround(fsArea[iIndex].xStart ,fsArea[iIndex].yStart + FS_FILELIST_YSTEP * pFsJpeg->file_current,fsArea[iIndex].xSize,1,LAY_FILE_BG_10_1 + pFsJpeg->file_current );
    }
	else if ((iIndex == FS_AREA_FILEICON) && (refresh_file_page == 1))
	{// clear all file icon
		for (i = 0;i < PER_PAGE;i ++)
        {
            FSGUI_DrawBackGround(fsArea[iIndex].xStart ,fsArea[iIndex].yStart + FS_FILELIST_YSTEP*i,fsArea[iIndex].xSize,1,LAY_FILE_BG_10_1 + i );
        }
	} 
	else if (iItem > PER_PAGE)
	{//clear all items or dir icons
		for (i = 0;i < PER_PAGE;i ++)
        {
            FSGUI_DrawBackGround(fsArea[iIndex].xStart  ,fsArea[iIndex].yStart + FS_FILELIST_YSTEP*i,fsArea[iIndex].xSize,1,LAY_FILE_BG_10_1 + i );
        } 
	}
	else //iItem <= PER_PAGE
	{//clear current item
		FSGUI_DrawBackGround(fsArea[iIndex].xStart , fsArea[iIndex].yStart + iItem * 32, fsArea[iIndex].xSize, 1,LAY_FILE_BG_10_1+iItem);
	}
}

#if 0
/*
 * Description:
 *      only for DIR and FILE RECT 
 *      according the file state, draw its item.
 *      1)when HL chaned from one file to another file, 
 *        must redraw last HL file, HL current file.
 *      2)when curent playing file changed ,must redraw 
 *         last playing file, make the current file be playing sate. 
 *
 * INPUT:   
 *      CurrentPos --->  this file position in DIR(FILE)RECT. It's value is 0~7 (if onepage has 8 fileitem).
 *      iState     --->  the file current state
 *                       HL_STATE       //HL in this button
 *                       PRESS_STATE    //now playing the type file
 *                       NONE_STATE     //has no HL and no playing file
 *      iType      --->  the file in DIR RECT 
 *                             or in FILE RECT
 *
 */
void FSGUI_UpdateItem(UINT16 CurrentPos, BYTE iState, BYTE iType)
{
   #if 0
    //according its iState select its backgroud bmp.
    //background start position according its iType and CurrentPos.
    if (iState == NONE_STATE)
        FrameBuf_DrawBackGround();
    else//HL_STATE / Press_STATE
        FrameBuf_DrawRect();
        
    //Show file item String
    FSGUI_ShowString();
    #endif
}

#endif

/*
 * Description:
 *      Draw file area scroll
 *
 * Creator:suqioali
 * Data:2004-6-15 
 *
 */
#ifdef GPS_MP3_UI//frank.huang 050923 add for GPS_MP3 SCOLL_BAR
void DrawScroll(void)
{
    int  x, y, xRepeat, yRepeat;
		
    x = fsArea[FS_AREA_SLOT].xStart;
    y = fsArea[FS_AREA_SLOT].yStart;
    xRepeat = 1;//fsArea[FS_AREA_SLOT].xSize;
    yRepeat = FS_DIRSCROLLLEN_YSIZE;//fsArea[FS_AREA_SLOT].ySize/FS_DIRSCROLLLEN_YSIZE;
    
    FSGUI_DrawBackGround(x,y,xRepeat,yRepeat,SLIDER_BODY);
	//FSGUI_DrawBackGround(x,y,xRepeat,yRepeat,LAY_BG_3_2);

}
/*
 * Description:
 *      Draw dir area scroll
 *
 * Creator:suqioali
 * Data:2004-6-15 
 *
 */
void DIR_DrawScroll(void)
{
    int  x, y, xRepeat, yRepeat;

    x = fsArea[FS_AREA_DIR_SLOT].xStart;
    y = fsArea[FS_AREA_DIR_SLOT].yStart;
   	xRepeat = 1;//fsArea[FS_AREA_SLOT].xSize;
    yRepeat = FS_DIRSCROLLLEN_YSIZE;//fsArea[FS_AREA_SLOT].ySize/FS_DIRSCROLLLEN_YSIZE;
    
    //FrameBuf_DrawRect(x, y, xSize, ySize,BLUE_Y, BLUE_CRCB);
    FSGUI_DrawBackGround(x,y,xRepeat,yRepeat,SLIDER_BODY);
}

#else//ifdef GPS_MP3_UI//frank.huang 050923

void DrawScroll(void)
{
    int  x, y, xRepeat, yRepeat;

    x = fsArea[FS_AREA_SLOT].xStart;
    y = fsArea[FS_AREA_SLOT].yStart;
    xRepeat = fsArea[FS_AREA_SLOT].xSize;
    yRepeat = fsArea[FS_AREA_SLOT].ySize/FS_DIRSCROLLLEN_YSIZE;
    
    //FrameBuf_DrawRect(x, y, xSize, ySize,BLUE_Y, BLUE_CRCB);//Draw rect
    FSGUI_DrawBackGround(x,y,xRepeat,yRepeat,LAY_BG_3_2);
}

/*
 * Description:
 *      Draw dir area scroll
 *
 * Creator:suqioali
 * Data:2004-6-15 
 *
 */
void DIR_DrawScroll(void)
{
    int  x, y, xRepeat, yRepeat;

    x = fsArea[FS_AREA_DIR_SLOT].xStart;
    y = fsArea[FS_AREA_DIR_SLOT].yStart;
    xRepeat = fsArea[FS_AREA_DIR_SLOT].xSize;
    yRepeat = fsArea[FS_AREA_DIR_SLOT].ySize/FS_DIRSCROLLLEN_YSIZE;
    
    //FrameBuf_DrawRect(x, y, xSize, ySize,BLUE_Y, BLUE_CRCB);
    FSGUI_DrawBackGround(x,y,xRepeat,yRepeat,LAY_BG_3_2);
}

#endif


/*
 * Description:
 *      Draw file area move scroll
 *
 * Creator:suqioali
 * Data:2004-6-15 
 *
 */
void MoveScroll(UINT16 locate)
{
    
    int y;

    DrawScroll();
    
    if (( locate == pFsJpeg->File_Page_Count - 1)&& (pFsJpeg->File_Page_Count != 1))
        y = ( fsArea[FS_AREA_MOVEBAR].yStart + fsArea[FS_AREA_MOVEBAR].ySize ) - pFsJpeg->scroll_step;//-(8-PER_PAGE)*32;//0x179
    else
        y = fsArea[FS_AREA_MOVEBAR].yStart + locate * pFsJpeg->scroll_step;
    #ifdef	GPS_MP3_UI//frank.huang  050923
	FSGUI_DrawBackGround(fsArea[FS_AREA_MOVEBAR].xStart,y, 1, pFsJpeg->scroll_len,SLIDER_BLOCK);
	if(pFsJpeg->scroll_len)
	{
		FSGUI_LayPosVariableBmp(fsArea[FS_AREA_MOVEBAR].xStart, y-3, SLIDER_BLOCK_U);
		FSGUI_LayPosVariableBmp(fsArea[FS_AREA_MOVEBAR].xStart, y+pFsJpeg->scroll_len, SLIDER_BLOCK_D);
	}
	#else
    FrameBuf_DrawRect(fsArea[FS_AREA_MOVEBAR].xStart, y, fsArea[FS_AREA_MOVEBAR].xSize, pFsJpeg->scroll_len,
        SCROLL_Y, SCROLL_CRCB);
	#endif


}



/*
 * Description:
 *      Draw dir area move scroll
 *
 * Creator:suqioali
 * Data:2004-6-15 
 *
 */
void DIR_MoveScroll(UINT16 locate)
{
    int y;
    
    DIR_DrawScroll();
    
    if (( locate == dir_count_page - 1)&& (dir_count_page != 1))
        y = ( fsArea[FS_AREA_DIR_MOVEBAR].yStart + fsArea[FS_AREA_DIR_MOVEBAR].ySize ) - dir_scroll_step;
    else
        y = fsArea[FS_AREA_DIR_MOVEBAR].yStart + locate * dir_scroll_step;
    #ifdef	GPS_MP3_UI//frank.huang 050923
	FSGUI_DrawBackGround(fsArea[FS_AREA_DIR_MOVEBAR].xStart,y, 1, dir_scroll_len,SLIDER_BLOCK);
	if(dir_scroll_len)
	{
		FSGUI_LayPosVariableBmp(fsArea[FS_AREA_DIR_MOVEBAR].xStart, y-3, SLIDER_BLOCK_U);
		FSGUI_LayPosVariableBmp(fsArea[FS_AREA_DIR_MOVEBAR].xStart, y+dir_scroll_len, SLIDER_BLOCK_D);
	}
	#else
    FrameBuf_DrawRect(fsArea[FS_AREA_DIR_MOVEBAR].xStart, y, fsArea[FS_AREA_DIR_MOVEBAR].xSize, dir_scroll_len,
        SCROLL_Y, SCROLL_CRCB);
	#endif
}

void SelectHL()
{
    int iFiles;

#ifdef MP3_DIRECT_SELECT
    iFiles = pFsJpeg->count_file[pFsJpeg->gifsFuncBtn - FS_FUNC_MP3];
#else
    iFiles = pFsJpeg->file_specify_in_dir;
#endif

    HL_Width = 252;
//in order to display playing dir
#if 0
    //ShowHL();//move to the last of SelectHL() zhaoyanhua  2004-2-2 17:13
#ifdef MP3_TXT_DISPLAY //zhaoyanhua add 2003-9-2 9:40
    if ( ( (JPEG_Preview_drawed == DIR_LIST_IN_DIR_AREA)
         &&(pFsJpeg->gifsFuncBtn != FS_FUNC_MP3) )
      || ( (MP3_Lyrics_Drawed == DIR_LIST_IN_DIR_AREA)
         &&(pFsJpeg->gifsFuncBtn == FS_FUNC_MP3)))//zhaoyanhua modify 2003-8-28 13:29
#else
    //to avoid the bug : when play JPEG, BUTTON->FILE  (RIGHT) or(UP) ,not draw DIR playing again.
    //zhaoyanhua modify 2003-12-27 11:10
    if ( ((JPEG_Preview_drawed == DIR_LIST_IN_DIR_AREA) &&(!(pFsJpeg->gifsbPreview))
        &&(pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG))//for JPEG 
      ||((JPEG_Preview_drawed == DIR_LIST_IN_DIR_AREA) && (pFsJpeg->gifsFuncBtn != FS_FUNC_JPEG))//for MP3/OTHER 
       )
#endif

#endif

        ShowCurrentDirPlaying();
    	ShowCurrentFilePlaying();
    
	if ((old_ControlArea != pFsJpeg->ControlArea) 
	    || (pFsJpeg->ControlArea < CNT_AREA_MP3BUTTON))//only for right and left command or in dir and file area //feeling
        ShowHL();
}



void ShowHL(void)
{
    #ifdef AUDIO_SHOW_SAVER
    if (bDisableGUI) return;
    #endif


    // clear last HL
    switch (old_ControlArea)
    {
        case  CNT_AREA_FILE:
                //zhaoyanhua add 2004-2-2 16:54
                //make some changes for the GUI not blink .
                if(HL_show == fsnav_file_HL)
                    ShowCurrentFilePlaying();
                else
                {
                    FSGUI_ClearArea(FS_AREA_FILEITEM,HL_show);
                    ShowFileIcon();
                    FSShowFileItem(HL_show, FS_GetFileProperty(pFsJpeg->file_array[HL_show],FILE_PROPERTY_NAME));//resume the last HL
                    //FSShowFileItem(HL_show, iso9660_file[pFsJpeg->file_array[HL_show]].name);//resume the last HL
                }
                break;
        case  CNT_AREA_DIR:
                //zhaoyanhua add 2004-2-2 16:54

⌨️ 快捷键说明

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