FileModeGUI_pub.c
上传用户:poi891205
上传日期:2013-07-15
资源大小:9745k
文件大小:80k
源码类别:

DVD

开发平台:

C/C++

  1. /*-------------------------------------------------------------------------------
  2. |  File Name   :  FileModeGUI_pub.c
  3. |
  4. |  Description :  Support USB/Card FAT File mode UI for copy and delete
  5. |
  6. |  Version    :   0.1  
  7. |  Rev Date         Author(s)      Status & Comments
  8. |---------------------------------------------------------------------------------
  9. |  0.1 2004/12/31       sunzhonghui         Creating
  10. |--------------------------------------------------------------------------------*/
  11. #ifdef FILE_MODE_WRITE
  12. #include "fsNAV.h"
  13. #include "fsGUI1.h"
  14. #include "global.h"
  15. //ir related
  16. #include "iop.h"
  17. #include "ircode.h"
  18. extern const BYTE ir_mapcode[256]; 
  19. //to save the last access meida flag : MEDIA_CD or MEDIA_CARD
  20. BYTE last_access_media = 0;
  21. extern void SwitchMedia(BYTE direction);
  22. //0:no CD,1:CD exists
  23. unsigned int detect_CD = 0;
  24. //input table related
  25. BYTE  Max_left_flag;
  26. BYTE  Max_input_flag;
  27. BYTE  Exit_Enter_flag;
  28. char  *Str_temp;
  29. char  *StrExit="EXIT";
  30. char  *StrEnter="ENTER";
  31. char  GetString[9] = {"        "};
  32. int   input_xoffset;
  33. int   Str_Index_x,Str_Index_y;
  34. UINT8 Item_Num[5][8] = {{ 0, 1, 2, 3, 4, 5, 6, 7},
  35.                         { 8, 9,10,11,12,13,14,15},
  36.                         {16,17,18,19,20,21,22,23},
  37.                         {24,25,26,27,28,29,30,31},
  38.                         {32,33,34,35,36,37,38,39}};
  39. char *Item_Str[] = {   
  40.                        "A","B","C","D","E","F","G","H","I","J",
  41.                        "K","L","M","N","O","P","Q","R","S","T",
  42.                        "U","V","W","X","Y","Z","1","2","3","4",
  43.                        "5","6","7","8","9","0","~","_","-","\"};
  44. //others
  45. extern const BTNAREA Rect[];
  46. extern const BTNAREA fsArea[];
  47. extern void  DrawFileIconX(int x, int y, int type, int mono);
  48. #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  49. extern int  old_ControlArea; //record last ControlArea.
  50. extern int  HL_show;//record HL .
  51. #endif
  52. BYTE   *mediaStr[];
  53. BYTE   srceType_flag;
  54. BYTE   file_mode_flag = 0;
  55. extern void osd_init_periphGUI(void);
  56. extern void osd_DrawRegionString(UINT32 xStart, UINT32 yStart, const BYTE *str, BYTE fontColor, BYTE bkColor, BYTE r);
  57. extern void osd_draw_region_rect(UINT32 xStart, UINT32 yStart, UINT32 xLen, UINT32 yLen, BYTE bkColor, BYTE r);
  58. extern void osd_init_MediaswitchGUI(void);
  59. extern int  ReadCDTitle(void);
  60. //buffer areas
  61. UINT32 iso9660buf_src = SDRAM_BASE + FS9660YA * 1024;
  62. UINT32 iso9660buf_des = SDRAM_BASE + FS_STRUCTURE_YA * 1024;
  63. FSJPEGDATA  *pFsJpeg_des_buf = (FSJPEGDATA  *)(SDRAM_BASE + FSJPEGDATA_DES_YA*1024);
  64. //debug related
  65. #ifndef DVDRELEASE
  66. #define FILE_MODE_WRITE_DBG  1
  67. #endif
  68. #define D printf("INFO: __%d__(%s:%s)n",__LINE__,__FILE__,__FUNCTION__);
  69. #ifndef FILE_MODE_WRITE_DBG
  70.     #undef printf
  71.     #undef print_block
  72.     #define printf(f, a...) do {} while (0)
  73.     #define print_block(x,y) do {} while (0)
  74. #endif
  75. //main functions of FileMode Write
  76. #include "FileMode_pub.h"
  77. #include "FileMode_pub.c"
  78. /****************************************************************************************
  79.  *                                                                                       *
  80.  *  Function Name : Draw_FileMode_Menu                                                   *
  81.  *                                                                                       *
  82.  *  Purposes      :                                                                      *
  83.  *                                                                                       *
  84.  *  Descriptions  :                                                                      *
  85.  *                                                                                       *
  86.  *  Arguments     : (none)                                                               *
  87.  *                                                                                       *
  88.  *  Returns       : (none)                                                               *
  89.  *                                                                                       *
  90.  *  See also      :                                                                      *
  91.  *                                                                                       *
  92. ****************************************************************************************/
  93. void Draw_FileMode_Menu(void)
  94. {
  95.     refresh_dir_page=1;
  96.     refresh_file_page=1;
  97. #ifdef MP3_LARGE_GUI
  98.     set_disbuf_now(0);
  99. #endif
  100. #ifdef NEW_MP3_GUI
  101.     // background
  102.     #ifdef MP3_LARGE_GUI
  103.     FSGUI_FillFrameBuf(0,0, 720, 480, BK_GROUNDY,BK_CRCB);
  104.     #else
  105.     FSGUI_FillFrameBuf(0,0,352,288,BK_GROUNDY,BK_CRCB);
  106.     #endif
  107.     //draw left,right and bottom rec area
  108.     #ifdef MONO_FSGUI //FS GUI, axel 2003-12-29 23:26
  109.     DrawRectCorner(Rect[DIR_RECT], CORNER_RAD, 1,1, DIR_AREA_BKGROUND_CRCB);
  110.     DrawRectCorner(Rect[FILE_RECT], CORNER_RAD,  1, 1, FILE_AREA_BKGROUND_CRCB);
  111.     #else
  112.     DrawRectCorner(Rect[DIR_RECT], CORNER_RAD, 1,DIR_STEP, DIR_AREA_BKGROUND_CRCB);
  113.     DrawRectCorner(Rect[FILE_RECT], CORNER_RAD,  1, FILE_STEP, FILE_AREA_BKGROUND_CRCB);
  114.     #endif
  115. //    DrawRect(Rect[INFO_RECT].xStart,Rect[INFO_RECT].yStart,Rect[INFO_RECT].xSize,Rect[INFO_RECT].ySize, 1, BK_GROUNDY,BK_CRCB);
  116.     DrawRectCorner(Rect[INFO_RECT], CORNER_RAD,1, 40, DIR_AREA_BKGROUND_CRCB );
  117. #elif defined FS_BMP_GUI
  118.     // show background
  119.     FSGUI_DrawBackGround(BG_XSTART, BG_YSTART + 0, BG_XREPEAT, BG_YREPEAT,LAY_BG_3_1);
  120.     FSGUI_DrawBackGround(BG_XSTART, BG_YSTART + 0xaa, BG_XREPEAT, BG_YREPEAT,LAY_BG_3_2);
  121.     FSGUI_DrawBackGround(BG_XSTART, BG_YSTART + 0x17d, BG_XREPEAT, BG_YREPEAT, LAY_BG_3_3);
  122.     // dir background and file background
  123.     FSGUI_ShowBmpCornerRect(DIR_AREA_XSTART, DIR_AREA_YSTART, DIR_AREA_XLEN, DIR_AREA_YLEN);
  124.     FSGUI_ShowBmpCornerRect(FILE_AREA_XSTART, FILE_AREA_YSTART, FILE_AREA_XLEN, FILE_AREA_YLEN);
  125. //draw the left and right edge of the info area
  126. FSGUI_LayoutBmp(LAY_PLAYING_BAR_3_1);
  127. FSGUI_LayoutBmp(LAY_PLAYING_BAR_3_3);
  128.      //draw the info area background
  129. FSGUI_DrawBackGround(fsArea[FS_AREA_PATHBACKGROUND].xStart ,
  130. fsArea[FS_AREA_PATHBACKGROUND].yStart,
  131. fsArea[FS_AREA_PATHBACKGROUND].xSize,
  132. fsArea[FS_AREA_PATHBACKGROUND].ySize,
  133. LAY_PLAYING_BAR_3_2);
  134. #else //NEW_MP3_GUI
  135. // background
  136. FSGUI_FillFrameBuf(0,0,352,288,BK_GROUNDY,BK_GROUNDCRCB);
  137. // high line
  138. FSGUI_FillFrameBuf(0,Y1,352,LIGHT_WID,WHITE_Y,WHITE_CRCB);
  139. FSGUI_FillFrameBuf(0, Y1+LIGHT_WID,
  140. X1, SHADOW_WID,
  141. BLACK_Y, BLACK_CRCB);
  142. FSGUI_FillFrameBuf(X1+LIGHT_WID+SHADOW_WID, Y1+LIGHT_WID,
  143. 352-X1-LIGHT_WID-SHADOW_WID, SHADOW_WID,
  144. BLACK_Y, BLACK_CRCB);
  145. FSGUI_FillFrameBuf(0, Y3,
  146. X1, LIGHT_WID,
  147. WHITE_Y,WHITE_CRCB);
  148. FSGUI_FillFrameBuf(X1+LIGHT_WID+SHADOW_WID, Y3,
  149. 352-X1-LIGHT_WID-SHADOW_WID, LIGHT_WID,
  150. WHITE_Y,WHITE_CRCB);
  151. FSGUI_FillFrameBuf(0, Y3+LIGHT_WID,
  152. 352, SHADOW_WID,
  153. BLACK_Y,BLACK_CRCB);
  154. FSGUI_FillFrameBuf(X1, Y1+LIGHT_WID,
  155. LIGHT_WID, Y3-Y1,
  156. WHITE_Y,WHITE_CRCB);
  157. FSGUI_FillFrameBuf(X1+LIGHT_WID, Y1+LIGHT_WID,
  158. SHADOW_WID, Y3-Y1-LIGHT_WID,
  159. BLACK_Y,BLACK_CRCB);
  160. DrawScroll();
  161. #endif //NEW_MP3_GUI
  162. #ifdef FS_BMP_GUI
  163.     FSGUI_ShowString( xStart + 46, 
  164. (FS_DIRLIST_YSTART+ FS_FILELIST_YSTEP * iItem ), 
  165. buf, file_focus_y, file_focus_CrCb);
  166. #else
  167.     FSGUI_ShowString( Rect[SRCE_TITILE_RECT].xStart,Rect[SRCE_TITILE_RECT].yStart, "SOURCE:", FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  168.     FSGUI_ShowString( Rect[DEST_TITLE_RECT].xStart,Rect[DEST_TITLE_RECT].yStart, "DESTINATION:", FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  169. #endif
  170.     MediaItem_List(FS_DIRLIST_XSTART,SRCE);
  171.     MediaItem_List(fsArea[FS_AREA_FILEITEM].xStart + 4,DEST);    
  172.     ShowWarning("PLEASE SELECT TO ENTER");
  173.     
  174.     old_ControlArea = CNT_AREA_SRCE;
  175.     pFsJpeg->ControlArea=CNT_AREA_SRCE;
  176.     HL_show = pFsJpeg->media_current = pFsJpeg->media_will=1;
  177.     FSGUI_FileMode_Init();
  178.     ShowHL();
  179.     Draw_File_Mode_Button();
  180. }
  181. /****************************************************************************************
  182.  *                                                                                       *
  183.  *  Function Name : Draw_File_Mode_Button                                                *
  184.  *                                                                                       *
  185.  *  Purposes      :                                                                      *
  186.  *                                                                                       *
  187.  *  Descriptions  :                                                                      *
  188.  *                                                                                       *
  189.  *  Arguments     : (none)                                                               *
  190.  *                                                                                       *
  191.  *  Returns       : (none)                                                               *
  192.  *                                                                                       *
  193.  *  See also      :                                                                      *
  194.  *                                                                                       *
  195. ****************************************************************************************/
  196. void Draw_File_Mode_Button(void)
  197. {
  198.     /*
  199.     if((pFsJpeg->ControlArea==CNT_AREA_SRCE)||(pFsJpeg->gifsState == FS_STATE_MEDIA))  
  200.     {
  201. FSGUI_FillFrameBuf(fsArea[FS_AREA_BUTTON].xStart, fsArea[FS_AREA_BUTTON].yStart, 25, 25, BK_GROUNDY, BK_GROUNDCRCB);         
  202.     }
  203.     else
  204.     */
  205. DrawRect(fsArea[FS_AREA_BUTTON].xStart, fsArea[FS_AREA_BUTTON].yStart,
  206. 25, 25,
  207. pFsJpeg->gifsFuncBtn == FS_FUNC_COPYING ? 1 : 0, BK_GROUNDY, BK_GROUNDCRCB);
  208.      DrawFileIconX(fsArea[FS_AREA_BUTTON].xStart +6, fsArea[FS_AREA_BUTTON].yStart + 6, 2,0);
  209. DrawRect(fsArea[FS_AREA_BUTTON].xStart+30, fsArea[FS_AREA_BUTTON].yStart,
  210. 25, 25,
  211. pFsJpeg->gifsFuncBtn == FS_FUNC_DELETE ? 1 : 0, BK_GROUNDY, BK_GROUNDCRCB);
  212.     DrawFileIconX(fsArea[FS_AREA_BUTTON].xStart + 30 +6, fsArea[FS_AREA_BUTTON].yStart + 6, CNT_AREA_MP3BUTTON - 2,0);
  213. DrawRect(fsArea[FS_AREA_BUTTON].xStart+60, fsArea[FS_AREA_BUTTON].yStart,
  214. 25, 25,
  215. pFsJpeg->gifsFuncBtn == FS_FUNC_NEW ? 1 : 0, BK_GROUNDY, BK_GROUNDCRCB);
  216.     DrawFileIconX(fsArea[FS_AREA_BUTTON].xStart + 60 +6, fsArea[FS_AREA_BUTTON].yStart + 6, CNT_AREA_MP3BUTTON - 2,0);
  217. DrawRect(fsArea[FS_AREA_BUTTON].xStart+90, fsArea[FS_AREA_BUTTON].yStart,
  218. 25, 25,
  219. pFsJpeg->gifsFuncBtn==FS_FUNC_RENAME ? 1 : 0, BK_GROUNDY, BK_GROUNDCRCB);
  220.     DrawFileIconX(fsArea[FS_AREA_BUTTON].xStart + 90 +6, fsArea[FS_AREA_BUTTON].yStart + 6, CNT_AREA_MP3BUTTON - 2,0);
  221. DrawRect(fsArea[FS_AREA_BUTTON].xStart+120, fsArea[FS_AREA_BUTTON].yStart,
  222. 25, 25,
  223. pFsJpeg->gifsFuncBtn==FS_FUNC_FORMAT ? 1 : 0, BK_GROUNDY, BK_GROUNDCRCB);
  224.     DrawFileIconX(fsArea[FS_AREA_BUTTON].xStart + 120 +6, fsArea[FS_AREA_BUTTON].yStart + 6, CNT_AREA_MP3BUTTON - 2,0);
  225. DrawRect(fsArea[FS_AREA_BUTTON].xStart+150, fsArea[FS_AREA_BUTTON].yStart,
  226. 25, 25,
  227. pFsJpeg->gifsFuncBtn==FS_FUNC_CAPACITY ? 1 : 0, BK_GROUNDY, BK_GROUNDCRCB);
  228.     DrawFileIconX(fsArea[FS_AREA_BUTTON].xStart + 150 +6, fsArea[FS_AREA_BUTTON].yStart + 6, CNT_AREA_MP3BUTTON - 2,0);     
  229. }
  230. /****************************************************************************************
  231.  *                                                                                       *
  232.  *  Function Name : FSShowFatIcon                                                        *                                                                               *
  233.  *  Purposes      :                                                                      *
  234.  *                                                                                       *
  235.  *  Descriptions  :                                                                      *
  236.  *                                                                                       *
  237.  *  Arguments     : (none)                                                               *
  238.  *                                                                                       *
  239.  *  Returns       : (none)                                                               *
  240.  *                                                                                       *
  241.  *  See also      :                                                                      *
  242.  *                                                                                       *
  243. ****************************************************************************************/
  244. void FSShowFatIcon(UINT16 xStart,UINT16 yLoc)
  245. {
  246.     BYTE mode;
  247.     
  248.     if (pFsJpeg->dir_array[yLoc] != pFsJpeg->fsnav_dir_now)
  249.         mode = 0;
  250.     else
  251.         mode = 1;
  252.     DrawFolderIcon(xStart, (FS_DIRLIST_YSTART + FS_FILELIST_YSTEP * yLoc), mode);
  253.     
  254. refresh_dir_icon = 0;
  255. }
  256. /****************************************************************************************
  257.  *                                                                                       *
  258.  *  Function Name : Media_detect                                                         *
  259.  *                                                                                       *
  260.  *  Purposes      :                                                                      *
  261.  *                                                                                       *
  262.  *  Descriptions  :                                                                      *
  263.  *                                                                                       *
  264.  *  Arguments     : (none)                                                               *
  265.  *                                                                                       *
  266.  *  Returns       : (none)                                                               *
  267.  *                                                                                       *
  268.  *  See also      :                                                                      *
  269.  *                                                                                       *
  270. ****************************************************************************************/
  271. int Media_detect(void)
  272. {
  273.     BYTE MediaItem=0;
  274.     
  275.     #ifdef FILE_MODE_WRITE_DBG
  276.     printf("detect_CD = %xn",detect_CD);
  277.     #endif
  278.     
  279.     if(detect_CD)
  280.     {
  281.         MediaItem++;
  282.         mediaStr[MediaItem]= "CDROM";                        
  283.     }
  284.    if(detect_type & USB_DEVICE)
  285.    {
  286.        MediaItem++;
  287.        mediaStr[MediaItem]= "U DISK";         
  288.    }
  289. #ifdef SPHE8202_CARD_STORAGE
  290.    #ifdef CARD_SETUP_TYPE_3   //256Pin 16bit Non_share mode All card. 
  291.    if(detect_type & CF_CARD_DEVICE) 
  292.    {
  293.        MediaItem++;
  294.        mediaStr[MediaItem]= "CF CARD";                                
  295.    }
  296.    #endif
  297.    if(detect_type & SD_CARD_DEVICE) 
  298.    {
  299.        MediaItem++;
  300.        mediaStr[MediaItem]= "SD/MMC";                                        
  301.    }
  302.    if(detect_type & MS_CARD_DEVICE)
  303.    {
  304.        MediaItem++;
  305.        mediaStr[MediaItem]= "MS/MSPRO";                                                
  306.    }
  307.    #ifdef CARD_SETUP_TYPE_3   //256Pin 16bit Non_share mode All card.       
  308.    if(detect_type & SMC_CARD_DEVICE) 
  309.    {
  310.        MediaItem++;
  311.        mediaStr[MediaItem]= "SMC CARD";                        
  312.    }
  313.    #endif  
  314. #endif
  315.    return MediaItem;
  316. }
  317. /****************************************************************************************
  318.  *                                                                                       *
  319.  *  Function Name : MediaItem_List                                                       *
  320.  *                                                                                       *
  321.  *  Purposes      :                                                                      *
  322.  *                                                                                       *
  323.  *  Descriptions  :                                                                      *
  324.  *                                                                                       *
  325.  *  Arguments     : (none)                                                               *
  326.  *                                                                                       *
  327.  *  Returns       : (none)                                                               *
  328.  *                                                                                       *
  329.  *  See also      :                                                                      *
  330.  *                                                                                       *
  331. ****************************************************************************************/
  332. void MediaItem_List(UINT16 xStart,BYTE media_flag)
  333. {
  334.     BYTE i,j;
  335.     int iconArea;
  336.     BYTE MediaItem = Media_detect();
  337.     if(!media_flag)
  338.     {
  339.         iconArea=FS_AREA_DIRICON;    
  340.         j=1;
  341.     }    
  342.     else
  343.     {
  344.         iconArea=FS_AREA_FILEICON;
  345.         if(mediaStr[1]== "CDROM")                
  346.         {
  347.             srceType_flag=1;               
  348.             j=2; 
  349.         }
  350.         else
  351.         {
  352.             srceType_flag=0; 
  353.             j=1;
  354.         }
  355.     }          
  356.     for(i=j;i<=MediaItem;i++)
  357.     {    
  358.         FSGUI_ShowString( xStart,(FS_DIRLIST_YSTART+ FS_FILELIST_YSTEP * (i-j) ), mediaStr[i], FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);        
  359.         FSShowFatIcon(fsArea[iconArea].xStart,i-j);    
  360.     }
  361. }
  362. /****************************************************************************************
  363.  *                                                                                       *
  364.  *  Function Name : ShowWarning                                                          *
  365.  *                                                                                       *
  366.  *  Purposes      :                                                                      *
  367.  *                                                                                       *
  368.  *  Descriptions  :                                                                      *
  369.  *                                                                                       *
  370.  *  Arguments     : (none)                                                               *
  371.  *                                                                                       *
  372.  *  Returns       : (none)                                                               *
  373.  *                                                                                       *
  374.  *  See also      :                                                                      *
  375.  *                                                                                       *
  376. ****************************************************************************************/
  377. void ShowWarning(const char *s)
  378. {
  379. char    buf[30];
  380. #ifdef AUDIO_SHOW_SAVER
  381. if (bDisableGUI) return;
  382. #endif
  383. psprintf(buf, "%s", s);
  384. #ifdef FS_BMP_GUI
  385.     FSGUI_ShowString( fsArea[FS_AREA_WARNING].xStart + 46,
  386. fsArea[FS_AREA_WARNING].yStart,
  387. buf, file_focus_y, file_focus_CrCb);
  388. #else
  389.     DrawRectCorner(Rect[INFO_RECT], CORNER_RAD,1, 40, DIR_AREA_BKGROUND_CRCB );
  390. FSGUI_ShowString( fsArea[FS_AREA_WARNING].xStart,
  391. fsArea[FS_AREA_WARNING].yStart,
  392. buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  393. #endif    
  394. }
  395. /****************************************************************************************
  396.  *                                                                                       *
  397.  *  Function Name : FileModeGUI_select                                                   *
  398.  *                                                                                       *
  399.  *  Purposes      :                                                                      *
  400.  *                                                                                       *
  401.  *  Descriptions  :                                                                      *
  402.  *                                                                                       *
  403.  *  Arguments     : (none)                                                               *
  404.  *                                                                                       *
  405.  *  Returns       : (none)                                                               *
  406.  *                                                                                       *
  407.  *  See also      :                                                                      *
  408.  *                                                                                       *
  409. ****************************************************************************************/
  410. void FileModeGUI_select(void)
  411. {
  412.     printf("n============FileModeGUI_select================n");     
  413.     int Res; 
  414.     BYTE media_return = 0;    
  415.     //input table select
  416.     if(full_scrn & INPUT_TBL)
  417.     {
  418.         input_str_func_select();
  419.         pFsJpeg->ControlArea = old_ControlArea;            
  420.         ShowHL();
  421.         return;
  422.     }
  423.     
  424.     if(pFsJpeg->ControlArea == CNT_AREA_COPYBUTTON)
  425.     {
  426.         if(pFsJpeg->gifsState == FS_STATE_INIT)
  427.         {
  428.             pFsJpeg->gifsFuncBtn = FS_FUNC_COPYING;
  429.             ButtonCopy();
  430.         }
  431.         else
  432.         {
  433.             ShowWarning("INVALID BUTTON NOW");
  434.         } 
  435.         ShowHL();
  436.         return;                
  437.     }
  438.     
  439.     if(pFsJpeg->ControlArea == CNT_AREA_DELETEBUTTON)
  440.     {
  441.         if(pFsJpeg->gifsState == FS_STATE_INIT)
  442.         {        
  443.             pFsJpeg->gifsFuncBtn = FS_FUNC_DELETE;
  444.             ButtonDelete();
  445.         }
  446.         else
  447.         {
  448.             ShowWarning("INVALID BUTTON NOW");
  449.         }
  450.         ShowHL();
  451.         return;                        
  452.     }    
  453.     if((pFsJpeg->ControlArea == CNT_AREA_NEWBUTTON) && !(full_scrn & INPUT_TBL))
  454.     {
  455.         if(pFsJpeg->gifsState == FS_STATE_INIT)
  456.         {
  457.             pFsJpeg->gifsFuncBtn = FS_FUNC_NEW;        
  458.             ButtonNew();
  459.         }
  460.         else
  461.             ShowWarning("INVALID BUTTON NOW");
  462.         ShowHL();
  463.         return;                        
  464.     }
  465.     
  466.     if((pFsJpeg->ControlArea == CNT_AREA_RENAMEBUTTON) && !(full_scrn & INPUT_TBL))
  467.     {
  468.         if(pFsJpeg->gifsState == FS_STATE_INIT)
  469.         {                        
  470.             pFsJpeg->gifsFuncBtn = FS_FUNC_RENAME;
  471.             ButtonRename();
  472.         }
  473.         else
  474.             ShowWarning("INVALID BUTTON NOW");
  475.         ShowHL();
  476.         return;                        
  477.     }
  478.     
  479.     if(pFsJpeg->ControlArea == CNT_AREA_FORMATBUTTON)
  480.     {
  481.         if(pFsJpeg->gifsState == FS_STATE_MEDIA)
  482.         {                
  483.             pFsJpeg->gifsFuncBtn = FS_FUNC_FORMAT;
  484.             ButtonFormat();
  485.         }
  486.         else
  487.             ShowWarning("INVALID BUTTON NOW");
  488.         ShowHL();
  489.         return;                        
  490.     }
  491.     
  492.     if(pFsJpeg->ControlArea == CNT_AREA_CAPACITYBUTTON)
  493.     {
  494.         pFsJpeg->gifsFuncBtn = FS_FUNC_CAPACITY;
  495.         ButtonCapacity();
  496.         return;                        
  497.     }              
  498.     
  499.     if(pFsJpeg->gifsState == FS_STATE_MEDIA)
  500.     {
  501.         pFsJpeg->gifsState = FS_STATE_INIT;
  502.                 
  503.         FileModeJudgeSelMedia();
  504.         if(media_type == MEDIA_CARD)
  505.         {
  506.             BYTE n;
  507.             n = pFsJpeg->media_will;     //to avoid pFsJpeg->media_will being changed
  508.             CardTestReady();             
  509.             FileModeGetInfo();
  510.             pFsJpeg->media_will = n;
  511.         }
  512.         else if(media_type == MEDIA_CD)
  513.         {
  514.             media_type = MEDIA_CD;
  515.             LoadModual(MODUAL_CDROM);
  516.             sys_cmd=(CMD_FUNC|CMD_FUNC_CLOSE);
  517.             ReadCDTitle();
  518.             system_state=SYSTEM_SETUP_BROWSER;          
  519.         }             
  520.         ReadFile(&Res);
  521.         pFsJpeg->file_index_in_dir = 0;
  522.         pFsJpeg->dir_current = 0;
  523.         HL_show = pFsJpeg->file_current_in_page = 0;
  524.         pFsJpeg->file_page_index = 0;        
  525.     } 
  526.     else if(pFsJpeg->gifsState == FS_STATE_INIT)
  527.     {
  528.         UINT16 index=0;
  529.         if(pFsJpeg->ControlArea == CNT_AREA_SRCE)
  530.             index = DirFileCount1[pFsJpeg->file_index_in_dir];
  531.         else if(pFsJpeg->ControlArea == CNT_AREA_DEST)
  532.             index = DirFileCount2[pFsJpeg->file_index_in_dir];
  533.         if((index > ISO_FILE_MAX)&& JudgeDir(index-ISO_FILE_MAX))
  534.         {   
  535.             pFsJpeg->file_index_in_dir = 0;
  536.             HL_show = pFsJpeg->file_current_in_page = 0;
  537.             pFsJpeg->file_page_index = 0;
  538.             pFsJpeg->dir_current = index-ISO_FILE_MAX;
  539.         }
  540.         else if(index == ISO_FILE_MAX)
  541.         {
  542.             pFsJpeg->file_index_in_dir = 0;
  543.             HL_show = pFsJpeg->file_current_in_page = 0; 
  544.             pFsJpeg->file_page_index = 0;
  545.             pFsJpeg->dir_current = iso9660_dir[pFsJpeg->dir_current].parent_dir;
  546.             if(pFsJpeg->dir_current == 0xffff)
  547.                 media_return = 1;
  548.         }   
  549.     }    
  550.     watchdog_onoff(0);//disable watchdog 
  551.     #ifdef FILE_MODE_WRITE_DBG
  552.     show_fat_dir_file_info();
  553.     #endif
  554.     FileModeGUI_Refresh();
  555.     if(media_return)
  556.     {
  557.         if(pFsJpeg->ControlArea == CNT_AREA_SRCE)
  558.         {            
  559.             MediaItem_List(FS_DIRLIST_XSTART,SRCE);
  560.             old_ControlArea = CNT_AREA_SRCE;
  561.             pFsJpeg->ControlArea = CNT_AREA_SRCE;
  562.         }          
  563.         else if(pFsJpeg->ControlArea == CNT_AREA_DEST)
  564.         {            
  565.             MediaItem_List(fsArea[FS_AREA_FILEITEM].xStart + 4,DEST); 
  566.             old_ControlArea = CNT_AREA_DEST;
  567.             pFsJpeg->ControlArea = CNT_AREA_DEST;            
  568.         }    
  569.         ShowWarning("PLEASE SELECT TO ENTER"); 
  570.         HL_show = pFsJpeg->media_will;   
  571.         FSGUI_FileMode_Init();
  572.     }      
  573.     else
  574.     FileMode_DirList(pFsJpeg->dir_current);                                   
  575.     ShowHL();
  576. }
  577. /****************************************************************************************
  578.  *                                                                                       *
  579.  *  Function Name : FileModeGUI_up                                                       *
  580.  *                                                                                       *
  581.  *  Purposes      :                                                                      *
  582.  *                                                                                       *
  583.  *  Descriptions  :                                                                      *
  584.  *                                                                                       *
  585.  *  Arguments     : (none)                                                               *
  586.  *                                                                                       *
  587.  *  Returns       : (none)                                                               *
  588.  *                                                                                       *
  589.  *  See also      :                                                                      *
  590.  *                                                                                       *
  591. ****************************************************************************************/
  592. void FileModeGUI_up(void)
  593. {
  594.     //input table up
  595.     if(full_scrn & INPUT_TBL)
  596.     {
  597.         input_str_func_up();
  598.         return;
  599.     }
  600.     
  601.     if((pFsJpeg->ControlArea == CNT_AREA_COPYBUTTON)||(pFsJpeg->ControlArea == CNT_AREA_DELETEBUTTON)
  602.     ||(pFsJpeg->ControlArea == CNT_AREA_NEWBUTTON)||(pFsJpeg->ControlArea == CNT_AREA_RENAMEBUTTON)
  603.     ||(pFsJpeg->ControlArea == CNT_AREA_FORMATBUTTON)||(pFsJpeg->ControlArea == CNT_AREA_CAPACITYBUTTON))
  604.         return;                
  605.     
  606.     printf("n============FileModeGUI_up================n");
  607.     if(pFsJpeg->gifsState == FS_STATE_MEDIA)
  608.     {
  609.         if(pFsJpeg->media_current<= pFsJpeg->count_media)
  610.         {
  611.             pFsJpeg->media_will--; 
  612.             if(pFsJpeg->media_will < 1)
  613.                 pFsJpeg->media_will = pFsJpeg->count_media;                        
  614.             pFsJpeg->media_current = pFsJpeg->media_will;                                             
  615.         }
  616.     }
  617.     else if(pFsJpeg->gifsState == FS_STATE_INIT)
  618.     {
  619.         if(pFsJpeg->file_index_in_dir > 0)
  620.         {
  621.             printf("index=%d,count=%dn",pFsJpeg->file_index_in_dir,pFsJpeg->file_count_in_dir);
  622.             pFsJpeg->file_index_in_dir--;
  623.             if(pFsJpeg->file_current_in_page > 0)
  624.                 pFsJpeg->file_current_in_page--;
  625.             else
  626.             {
  627.                 pFsJpeg->file_current_in_page = PER_PAGE-1;
  628.                 pFsJpeg->file_page_index--;
  629.                 FileModeGUI_Refresh();                                
  630.                 FileMode_DirList(pFsJpeg->dir_current);                                                
  631.             }
  632.         }       
  633.     }    
  634.     ShowHL();
  635. }
  636. /****************************************************************************************
  637.  *                                                                                       *
  638.  *  Function Name : FileModeGUI_down                                                     *
  639.  *                                                                                       *
  640.  *  Purposes      :                                                                      *
  641.  *                                                                                       *
  642.  *  Descriptions  :                                                                      *
  643.  *                                                                                       *
  644.  *  Arguments     : (none)                                                               *
  645.  *                                                                                       *
  646.  *  Returns       : (none)                                                               *
  647.  *                                                                                       *
  648.  *  See also      :                                                                      *
  649.  *                                                                                       *
  650. ****************************************************************************************/
  651. void FileModeGUI_down(void)
  652. {
  653.     //input table down
  654.     if(full_scrn & INPUT_TBL)
  655.     {
  656.         input_str_func_down();
  657.         return;
  658.     }
  659.     
  660.     printf("n============FileModeGUI_down================n");
  661.     
  662.     if((pFsJpeg->ControlArea == CNT_AREA_COPYBUTTON)||(pFsJpeg->ControlArea == CNT_AREA_DELETEBUTTON)
  663.     ||(pFsJpeg->ControlArea == CNT_AREA_NEWBUTTON)||(pFsJpeg->ControlArea == CNT_AREA_RENAMEBUTTON)
  664.     ||(pFsJpeg->ControlArea == CNT_AREA_FORMATBUTTON)||(pFsJpeg->ControlArea == CNT_AREA_CAPACITYBUTTON))
  665.         return;
  666.             
  667.     if(pFsJpeg->gifsState == FS_STATE_MEDIA)
  668.     {
  669.         if(pFsJpeg->media_current<= pFsJpeg->count_media)
  670.         {
  671.             pFsJpeg->media_will++; 
  672.             if(pFsJpeg->media_will > pFsJpeg->count_media)
  673.             {
  674.                 if((!srceType_flag)||(pFsJpeg->ControlArea == CNT_AREA_SRCE))
  675.                     pFsJpeg->media_will = 1;                        
  676.                 else if(srceType_flag)
  677.                     pFsJpeg->media_will = 2;                   
  678.             }
  679.             pFsJpeg->media_current = pFsJpeg->media_will;                           
  680.         }
  681.     }
  682.     else if(pFsJpeg->gifsState == FS_STATE_INIT)
  683.     {
  684.         if(pFsJpeg->file_index_in_dir < (pFsJpeg->file_count_in_dir-1))
  685.         {
  686.             printf("index=%d,count=%dn",pFsJpeg->file_index_in_dir,pFsJpeg->file_count_in_dir);
  687.             pFsJpeg->file_index_in_dir++;
  688.             if(pFsJpeg->file_current_in_page < (PER_PAGE-1))
  689.                 pFsJpeg->file_current_in_page++;
  690.             else
  691.             {
  692.                 pFsJpeg->file_current_in_page = 0;
  693.                 pFsJpeg->file_page_index++; 
  694.                 FileModeGUI_Refresh();
  695.                 FileMode_DirList(pFsJpeg->dir_current);                                
  696.             }
  697.         }          
  698.     }
  699.     ShowHL();       
  700. }
  701. /****************************************************************************************
  702.  *                                                                                       *
  703.  *  Function Name : FileModeGUI_left                                                     *
  704.  *                                                                                       *
  705.  *  Purposes      :                                                                      *
  706.  *                                                                                       *
  707.  *  Descriptions  :                                                                      *
  708.  *                                                                                       *
  709.  *  Arguments     : (none)                                                               *
  710.  *                                                                                       *
  711.  *  Returns       : (none)                                                               *
  712.  *                                                                                       *
  713.  *  See also      :                                                                      *
  714.  *                                                                                       *
  715. ****************************************************************************************/
  716. void FileModeGUI_left(void)
  717. {
  718.     printf("n============FileModeGUI_left================n");
  719.     //input table up
  720.     if(full_scrn & INPUT_TBL)
  721.     {
  722.         input_str_func_left();
  723.         return;
  724.     }
  725.     if(pFsJpeg->ControlArea == CNT_AREA_DEST)
  726.     {
  727.         Switch2SrcDesBuf(SRCE);
  728.         pFsJpeg->ControlArea = CNT_AREA_SRCE;                     
  729.     }
  730.     else if(pFsJpeg->ControlArea == CNT_AREA_SRCE)   
  731.     {              
  732.         if(pFsJpeg->gifsState == FS_STATE_INIT)
  733.         {
  734.             Switch2SrcDesBuf(DEST);
  735.                   
  736. //            if(pFsJpeg->gifsState == FS_STATE_INIT)
  737.                 pFsJpeg->ControlArea=CNT_AREA_COPYBUTTON;
  738. //            else 
  739. //                pFsJpeg->ControlArea=CNT_AREA_FORMATBUTTON; 
  740.            pFsJpeg->gifsFuncBtn = 0; 
  741.         }           
  742.     }
  743.     else
  744.     {
  745.         int buttonNum = pFsJpeg->ControlArea;
  746.         if(pFsJpeg->ControlArea >= CNT_AREA_COPYBUTTON)
  747.         {
  748.             buttonNum --;
  749.             pFsJpeg->ControlArea = buttonNum;
  750.         }
  751.         if(pFsJpeg->ControlArea < CNT_AREA_COPYBUTTON)
  752.         {
  753.             Switch2SrcDesBuf(SRCE);
  754.         }
  755.     }     
  756.     ShowHL();
  757.     ShowWarning("PLEASE SELECT TO ENTER");     
  758. }
  759. void FSGUI_FileMode_Init(void)
  760. {
  761.     pFsJpeg->gifsState = FS_STATE_MEDIA;
  762.     pFsJpeg->count_media = Media_detect();   
  763.         
  764.     pFsJpeg->file_index_in_dir = 0;
  765.     pFsJpeg->file_current_in_page = 0;
  766.     pFsJpeg->file_page_index = 0;
  767.     pFsJpeg->dir_current = 0;
  768.     pFsJpeg->iso9660_dir_cnt = 0;
  769.     pFsJpeg->iso9660_file_cnt = 0;
  770. }
  771. /****************************************************************************************
  772.  *                                                                                       *
  773.  *  Function Name : FileModeGUI_right                                                    *
  774.  *                                                                                       *
  775.  *  Purposes      :                                                                      *
  776.  *                                                                                       *
  777.  *  Descriptions  :                                                                      *
  778.  *                                                                                       *
  779.  *  Arguments     : (none)                                                               *
  780.  *                                                                                       *
  781.  *  Returns       : (none)                                                               *
  782.  *                                                                                       *
  783.  *  See also      :                                                                      *
  784.  *                                                                                       *
  785. ****************************************************************************************/
  786. void FileModeGUI_right(void)
  787. {
  788.     //input table right
  789.     if(full_scrn & INPUT_TBL)
  790.     {
  791.         input_str_func_right();
  792.         return;
  793.     }
  794.     
  795.     printf("n============FileModeGUI_right================n");
  796.     if(pFsJpeg->ControlArea == CNT_AREA_SRCE)
  797.     {
  798.         Switch2SrcDesBuf(DEST);
  799.         if(pFsJpeg->gifsState == FS_STATE_MEDIA)
  800.         {
  801.             pFsJpeg->ControlArea=CNT_AREA_DEST;
  802.             FSGUI_FileMode_Init();
  803.         
  804.             if(mediaStr[1] == "CDROM")
  805.                 pFsJpeg->media_will = pFsJpeg->media_current = 2;
  806.             else
  807.                 pFsJpeg->media_will = pFsJpeg->media_current = 1; 
  808.         }
  809.     }
  810.     else if(pFsJpeg->ControlArea == CNT_AREA_DEST)
  811.     {
  812.         pFsJpeg->ControlArea=CNT_AREA_CAPACITYBUTTON;  
  813.     }
  814.     else if(pFsJpeg->ControlArea == CNT_AREA_CAPACITYBUTTON)
  815.     {
  816.         pFsJpeg->ControlArea = CNT_AREA_DEST; 
  817.         pFsJpeg->gifsFuncBtn = 0;           
  818.         Switch2SrcDesBuf(DEST);
  819.         if(pFsJpeg->gifsState == FS_STATE_MEDIA)
  820.         {
  821.             pFsJpeg->ControlArea=CNT_AREA_DEST;
  822.             FSGUI_FileMode_Init();
  823.         
  824.             if(mediaStr[1] == "CDROM")
  825.                 pFsJpeg->media_will = pFsJpeg->media_current = 2;
  826.             else
  827.                 pFsJpeg->media_will = pFsJpeg->media_current = 1;             
  828.         }  
  829.         else  
  830.         HL_show = pFsJpeg->file_current_in_page;                            
  831.     }
  832.     else
  833.     {
  834.         int buttonNum = pFsJpeg->ControlArea;
  835.         if(pFsJpeg->ControlArea <= CNT_AREA_CAPACITYBUTTON)
  836.         {
  837.             buttonNum ++;
  838.             pFsJpeg->ControlArea = buttonNum;
  839.         }
  840.         if(pFsJpeg->ControlArea > CNT_AREA_CAPACITYBUTTON)
  841.         {
  842.             Switch2SrcDesBuf(DEST);
  843.         }
  844.     }                
  845.     ShowHL();
  846.     ShowWarning("PLEASE SELECT TO ENTER");     
  847. }
  848. //*******************************************************************************************//
  849. //play
  850. void FileModeGUI_play(void)
  851. {
  852.     printf("n============FileModeGUI_play================n");
  853.     if(pFsJpeg->gifsState == FS_STATE_MEDIA)
  854.     {
  855.         if(pFsJpeg->ControlArea == CNT_AREA_SRCE)
  856.         {
  857.             //to clear old control area.
  858.             old_ControlArea = 0;
  859.             
  860.             file_mode_flag = 0;
  861.             FileModeJudgeSelMedia();
  862.             FileModeSwitchMedia();
  863.         }
  864.     }
  865. }
  866. /****************************************************************************************
  867.  *                                                                                       *
  868.  *  Function Name : show_fat_dir_file_info                                               *
  869.  *                                                                                       *
  870.  *  Purposes      :  Show fat dir and file information in dubug.                         *
  871.  *                                                                                       *
  872.  *  Descriptions  :   Use for test.                                                      *
  873.  *                                                                                       *
  874.  *  Arguments     : (none)                                                               *
  875.  *                                                                                       *
  876.  *  Returns       : (none)                                                               *
  877.  *                                                                                       *
  878.  *  See also      :                                                                      *
  879.  *                                                                                       *
  880. ****************************************************************************************/
  881. void show_fat_dir_file_info(void) 
  882. {
  883. #ifdef FILE_MODE_WRITE_DBG    
  884.     printf("===========Show directory sturcture=========.n");
  885.     printf("===========all dir count:%d=========n",pFsJpeg->iso9660_dir_cnt);
  886.     int i,j,k;
  887.     for (i = 0; i < pFsJpeg->iso9660_dir_cnt; i++)
  888.     {
  889.         printf("nDir===%d:[%s],parent_dir===%dn", i, iso9660_dir[i].name,iso9660_dir[i].parent_dir);
  890.     }
  891.     printf("Show the file name in the related directory .n");
  892.     for (i = 0; i < pFsJpeg->iso9660_dir_cnt; i++)
  893.     {
  894.         printf("n===READ DIR:%d name:[%s],file amount:%d n",i,iso9660_dir[i].name,iso9660_dir[i].dir);
  895.         k=0;
  896.         for (j = 0; j < pFsJpeg->iso9660_file_cnt; j++)
  897.         {
  898.             if(i==iso9660_file[j].parent_dir)            
  899.             printf("  (%d)File:%sn",++k,iso9660_file[j].name);            
  900.               
  901.         }    
  902.     }
  903. #endif 
  904. void ShowFileItem(UINT16 xStart,int hl_index)
  905. {
  906.     UINT16 index;
  907.     index = hl_index+PER_PAGE*(pFsJpeg->file_page_index);
  908.     if(pFsJpeg->ControlArea == CNT_AREA_SRCE)
  909.         index = DirFileCount1[index];
  910.     else if((pFsJpeg->ControlArea == CNT_AREA_DEST)||(pFsJpeg->ControlArea == CNT_AREA_CAPACITYBUTTON))
  911.         index = DirFileCount2[index];
  912.     if(index == ISO_FILE_MAX)
  913.         ShowSrceItem(xStart, hl_index,"\..");         
  914.     else if(index > ISO_FILE_MAX)
  915.         ShowSrceItem(xStart, hl_index,iso9660_dir[(index-ISO_FILE_MAX)].name);            
  916.     else
  917.         ShowSrceItem(xStart, hl_index,iso9660_file[index].name);
  918. }
  919. /****************************************************************************************
  920.  *                                                                                       *
  921.  *  Function Name : Src_FileMode_DirList                                                 *
  922.  *                                                                                       *
  923.  *  Purposes      : Show all dir or file item  in that we select dir .                   *
  924.  *                                                                                       *
  925.  *  Descriptions  :                                                                      *
  926.  *                                                                                       *
  927.  *  Arguments     : (none)                                                               *
  928.  *                                                                                       *
  929.  *  Returns       : (none)                                                               *
  930.  *                                                                                       *
  931.  *  See also      :                                                                      *
  932.  *                                                                                       *
  933. ****************************************************************************************/
  934. void FileMode_DirList(UINT16 iDirIndex)
  935. {
  936.     #ifdef FILE_MODE_WRITE_DBG   
  937.     printf("n===========Src_FileMode_DirList=========.n");
  938.     #endif
  939.     int i = 0,j = 0;
  940.     UINT16 xStart; 
  941.     int iconArea;      
  942.     if(pFsJpeg == &(share_data.JPEG)) 
  943.     {
  944.         pFsJpeg->ControlArea=CNT_AREA_SRCE;
  945.         xStart = FS_DIRLIST_XSTART;
  946.         iconArea = FS_AREA_DIRICON;
  947.     } 
  948.     else if(pFsJpeg == pFsJpeg_des_buf) 
  949.     {
  950.         pFsJpeg->ControlArea=CNT_AREA_DEST; 
  951.         xStart = fsArea[FS_AREA_FILEITEM].xStart + 4;
  952.         iconArea = FS_AREA_FILEICON;        
  953.     }     
  954.     pFsJpeg->file_count_in_dir = JudgeDir(iDirIndex);//total file count.
  955.     printf("--------pFsJpeg->file_count_in_dir = %dn",pFsJpeg->file_count_in_dir);
  956.     if(pFsJpeg->file_count_in_dir >= PER_PAGE*(pFsJpeg->file_page_index+1))
  957.         j = PER_PAGE;
  958.     else
  959.         j = (pFsJpeg->file_count_in_dir) % PER_PAGE;
  960. for(i=0;i<j;i++)
  961. {
  962.     int index;
  963.         if(pFsJpeg->ControlArea == CNT_AREA_SRCE)
  964.         index = DirFileCount1[i+PER_PAGE*(pFsJpeg->file_page_index)];
  965.         else if(pFsJpeg->ControlArea == CNT_AREA_DEST)
  966.         index = DirFileCount2[i+PER_PAGE*(pFsJpeg->file_page_index)];  
  967.  
  968.     if(index == ISO_FILE_MAX )
  969.     {
  970.         printf("n===========\..=========n");
  971.             ShowSrceItem(xStart, 0,"\..");         
  972.     }
  973.     else if(index > ISO_FILE_MAX)
  974.     {   
  975.         printf("n===========FSShowMediaIcon=========n");
  976.             ShowSrceItem(xStart, i,iso9660_dir[(index-ISO_FILE_MAX)].name);            
  977.         FSShowFatIcon(fsArea[iconArea].xStart,i);         
  978.     }
  979.     else
  980.     {
  981.         printf("n===========FSShowFileIcon=========n");        
  982.             ShowSrceItem(xStart, i,iso9660_file[index].name); 
  983.         FSShowFileIcon(index, iconArea,i);        
  984.     }
  985. }
  986. }
  987. /****************************************************************************************
  988.  *                                                                                       *
  989.  *  Function Name : ShowSrceItem                                                         *
  990.  *                                                                                       *
  991.  *  Purposes      : Show Source dir or file item                                         *
  992.  *                                                                                       *
  993.  *  Descriptions  :                                                                      *
  994.  *                                                                                       *
  995.  *  Arguments     : (none)                                                               *
  996.  *                                                                                       *
  997.  *  Returns       : (none)                                                               *
  998.  *                                                                                       *
  999.  *  See also      :                                                                      *
  1000.  *                                                                                       *
  1001. ****************************************************************************************/
  1002. void ShowSrceItem(UINT16 xStart,int iItem, const char *s)
  1003. {
  1004.    char    buf[20];
  1005.     psprintf(buf,s);
  1006. #ifdef FS_BMP_GUI
  1007.     FSGUI_ShowString( xStart + 46, 
  1008. (FS_DIRLIST_YSTART+ FS_FILELIST_YSTEP * iItem ), 
  1009. buf, file_focus_y, file_focus_CrCb);
  1010. #else
  1011. FSGUI_ShowString( xStart, 
  1012. (FS_DIRLIST_YSTART+ FS_FILELIST_YSTEP * iItem ), 
  1013. buf, FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  1014. #endif    
  1015. }
  1016. /****************************************************************************************
  1017.  *                                                                                       *
  1018.  *  Function Name : FSShowFileIcon                                                       *
  1019.  *                                                                                       *
  1020.  *  Purposes      : Show file ICON                                                       *
  1021.  *                                                                                       *
  1022.  *  Descriptions  :                                                                      *
  1023.  *                                                                                       *
  1024.  *  Arguments     : (none)                                                               *
  1025.  *                                                                                       *
  1026.  *  Returns       : (none)                                                               *
  1027.  *                                                                                       *
  1028.  *  See also      :                                                                      *
  1029.  *                                                                                       *
  1030. ****************************************************************************************/
  1031. void FSShowFileIcon(UINT16 index, BYTE area, int yLoc)
  1032. {
  1033.     int type = 0;
  1034.     
  1035.     switch(iso9660_file[index].file_type)
  1036.     {
  1037.         case CDROM:
  1038.         case CDROM_WMA:
  1039.             type = CNT_AREA_MP3BUTTON - 2;
  1040.             break;
  1041.         case CDROM_JPEG:
  1042.             type = CNT_AREA_JPEGBUTTON - 2;
  1043.             break;
  1044.         case CDROM_MPG:
  1045.         case CDROM_DAT:
  1046.         case CDROM_MP4:
  1047.             type = CNT_AREA_OTHERBUTTON - 2;
  1048.             break;
  1049.     } 
  1050.     DrawFileIconX(fsArea[area].xStart+2,(fsArea[area].yStart+FS_FILELIST_YSTEP*yLoc),type,0);       
  1051. }
  1052. /****************************************************************************************
  1053.  *                                                                                       *
  1054.  *  Function Name : FileModeGUI_Refresh_Src                                              *
  1055.  *                                                                                       *
  1056.  *  Purposes      : Refresh source GUI                                                   *
  1057.  *                                                                                       *
  1058.  *  Descriptions  :                                                                      *
  1059.  *                                                                                       *
  1060.  *  Arguments     : (none)                                                               *
  1061.  *                                                                                       *
  1062.  *  Returns       : (none)                                                               *
  1063.  *                                                                                       *
  1064.  *  See also      :                                                                      *
  1065.  *                                                                                       *
  1066. ****************************************************************************************/
  1067. void FileModeGUI_Refresh(void)
  1068. {
  1069.     int i;
  1070.     if(pFsJpeg == &(share_data.JPEG)) 
  1071.         pFsJpeg->ControlArea=CNT_AREA_SRCE;
  1072.     else if(pFsJpeg == pFsJpeg_des_buf) 
  1073.         pFsJpeg->ControlArea=CNT_AREA_DEST; 
  1074.     if(pFsJpeg->ControlArea == CNT_AREA_SRCE)
  1075.     {
  1076.         for(i =0;i<PER_PAGE;i++)
  1077.         {
  1078.             ClearRectArea(Rect[DIR_RECT], DIR_STEP, DIR_AREA_BKGROUND_CRCB, FS_AREA_DIRICON,i);
  1079.             ClearRectArea(Rect[FS_AREA_DIRITEM], DIR_STEP, DIR_AREA_BKGROUND_CRCB, FS_AREA_DIRITEM, i);
  1080.         }
  1081.     }
  1082.     else if(pFsJpeg->ControlArea == CNT_AREA_DEST)
  1083.     {
  1084.         for(i=0; i<PER_PAGE;i++)
  1085.         {
  1086.             ClearRectArea(Rect[FILE_RECT], FILE_STEP, DIR_AREA_BKGROUND_CRCB, FS_AREA_FILEICON,i);        
  1087.             ClearRectArea(Rect[FILE_RECT], FILE_STEP, FILE_AREA_BKGROUND_CRCB,FS_AREA_FILEITEM, i);
  1088.         }
  1089.     }            
  1090. }
  1091. /****************************************************************************************
  1092.  *                                                                                       *
  1093.  *  Function Name : FileModeMainLoop                                                     *
  1094.  *                                                                                       *
  1095.  *  Purposes      : Get key code & call related functions.                               *
  1096.  *                                                                                       *
  1097.  *  Descriptions  : Only up,down,right,left,select,return,play KEY valid.                *
  1098.  *                  Called by ircmd_mute().                                              *
  1099.  *                                                                                       *
  1100.  *  Arguments     : (none)                                                               *
  1101.  *                                                                                       *
  1102.  *  Returns       : (none)                                                               *
  1103.  *                                                                                       *
  1104.  *  See also      : Creator : wangwei,2005-1-8 14:36                                     *
  1105.  *                                                                                       *
  1106. ****************************************************************************************/
  1107. void FileModeMainLoop(void)
  1108. {
  1109.     file_mode_flag = 1;    
  1110.     FSGUI_FileMode_Init();        
  1111.     UINT32 rx;
  1112.     
  1113.     watchdog_onoff(0);//disable watchdog 
  1114.     
  1115.     for(;;)//main loop
  1116.     {
  1117.         //to get key code
  1118.         rx = regs0->iop_data[IR_PORT];
  1119.         if (rx & IR_RDY)
  1120.         {
  1121.             rx = reverse_fun(rx);
  1122.             rx = ir_mapcode[(BYTE) rx];
  1123.             regs0->iop_data[IR_PORT] &= (~IR_RDY);  
  1124.         }
  1125.         //--------------------------------------------------------------
  1126.         if(rx == IRC_UP)         //IRC_UP
  1127.         {
  1128.             FileModeGUI_up();
  1129.         }
  1130.         //--------------------------------------------------------------
  1131.         else if(rx == IRC_DOWN)  //IRC_DOWN
  1132.         {
  1133.             FileModeGUI_down();
  1134.         }
  1135.         //--------------------------------------------------------------
  1136.         else if(rx == IRC_RIGHT) //IRC_RIGHT
  1137.         {
  1138.             FileModeGUI_right();
  1139.         }
  1140.         //--------------------------------------------------------------
  1141.         else if(rx == IRC_LEFT)  //IRC_LEFT
  1142.         {
  1143.             FileModeGUI_left();
  1144.         }
  1145.         //--------------------------------------------------------------
  1146.         else if(rx == IRC_SELECT)//IRC_SELECT
  1147.         {
  1148.             FileModeGUI_select();
  1149.         }
  1150.         //--------------------------------------------------------------
  1151.         else if((rx == IRC_PLAY_RESUME)||(rx == IRC_PLAY))  //IRC_PLAY
  1152.         {
  1153.             FileModeGUI_play();
  1154.             break;
  1155.         }
  1156.         //--------------------------------------------------------------
  1157.         else if(rx == IRC_EJECT)  //IRC_EJECT
  1158.         {
  1159.             call_ir_func(IRC_EJECT);
  1160.             play_state = VCD_STATE_OPEN;
  1161.             system_state=SYSTEM_OPEN;    
  1162.             break;
  1163.         }
  1164.         //--------------------------------------------------------------
  1165.         else if(rx == IRC_POWER)  //IRC_POWER
  1166.         {
  1167.              call_ir_func(IRC_POWER);
  1168.              play_state = VCD_STATE_POWER;  
  1169.              system_state=SYSTEM_POWER;  
  1170.             break;
  1171.         }
  1172.         //--------------------------------------------------------------
  1173.         watchdog_onoff(0);//disable watchdog 
  1174.     }
  1175.     //to clear old control area.
  1176.     old_ControlArea = 0;      
  1177.     
  1178.     watchdog_renew(0xffff);//renew watchdog
  1179.     watchdog_onoff(1);//enable watchdog
  1180. }
  1181. /****************************************************************************************
  1182.  *                                                                                       *
  1183.  *  Function Name : FileModeJudgeSelMedia                                                *
  1184.  *                                                                                       *
  1185.  *  Purposes      : To judge whitch media we select                                      *
  1186.  *                                                                                       *
  1187.  *  Descriptions  : To judge whitch media we select & store it in                        *
  1188.  *                  variable current_access_storage                                      *
  1189.  *                                                                                       *
  1190.  *  Arguments     : (none)                                                               *
  1191.  *                                                                                       *
  1192.  *  Returns       : (none)                                                               *
  1193.  *                                                                                       *
  1194.  *  See also      : Creator : wangwei,2005-1-8 14:36                                     *
  1195.  *                                                                                       *
  1196. ****************************************************************************************/
  1197. void FileModeJudgeSelMedia(void)
  1198. {
  1199.     if(mediaStr[pFsJpeg->media_will] == "CDROM")
  1200.     {
  1201.         printf("========== CDROM =============n");
  1202.         media_type = MEDIA_CD;    
  1203.     }
  1204.     else
  1205.     {
  1206.         media_type = MEDIA_CARD;
  1207.         if(mediaStr[pFsJpeg->media_will] == "U DISK")
  1208.         {
  1209.             printf("========== U DISC =============n");
  1210.             storage_type = USB_DEVICE;
  1211.         }
  1212.         else if(mediaStr[pFsJpeg->media_will] == "CF CARD")
  1213.         {
  1214.             printf("========== CF CARD =============n");
  1215.             storage_type = CF_CARD_DEVICE;
  1216.         }
  1217.         else if(mediaStr[pFsJpeg->media_will] == "SD/MMC")
  1218.         {
  1219.             printf("========== SD/MMC =============n");
  1220.             storage_type = SD_CARD_DEVICE;
  1221.         }
  1222.         else if(mediaStr[pFsJpeg->media_will] == "MS/MSPRO")
  1223.         {
  1224.             printf("========== MS/MSPRO =============n");
  1225.             storage_type = MS_CARD_DEVICE;
  1226.         }
  1227.         else if(mediaStr[pFsJpeg->media_will] == "SMC CARD")
  1228.         {
  1229.             printf("========== SMC CARD =============n");
  1230.             storage_type = SMC_CARD_DEVICE;
  1231.         }
  1232.     }
  1233. }
  1234. /****************************************************************************************
  1235.  *                                                                                       *
  1236.  *  Function Name : FileModeSwitchMedia                                                  *
  1237.  *                                                                                       *
  1238.  *  Purposes      : Switch to selected device                                            *
  1239.  *                                                                                       *
  1240.  *  Descriptions  : Switch to selected device                                            *
  1241.  *                                                                                       *
  1242.  *  Arguments     : (none)                                                               *
  1243.  *                                                                                       *
  1244.  *  Returns       : (none)                                                               *
  1245.  *                                                                                       *
  1246.  *  See also      : Creator : wangwei,2005-1-8 14:36                                     *
  1247.  *                                                                                       *
  1248. ****************************************************************************************/
  1249. void FileModeSwitchMedia(void)
  1250. {
  1251.     if(last_access_media == MEDIA_CD)
  1252.     {
  1253.         if(media_type == MEDIA_CARD)
  1254.             SwitchMedia(CD2CARD);
  1255.         else
  1256.         {
  1257.             no_disk_cnt = DETECT_TIMES;
  1258.             media_type = MEDIA_CD;          
  1259.             adv_search_time = 0;
  1260.             play_state = VCD_STATE_CLOSE;   
  1261.             full_scrn = 0;     
  1262.             ClearOsdMsg(0);
  1263.             t_disp = 0; 
  1264.             osd_init();              
  1265.             system_state = SYSTEM_OPEN;
  1266.         }
  1267.     }
  1268.     else if(last_access_media == MEDIA_CARD)
  1269.     {
  1270.         if(media_type == MEDIA_CARD )
  1271.             SwitchMedia(CARD2CARD);
  1272.         else
  1273.             SwitchMedia(CARD2CD);
  1274.     }
  1275. }
  1276. /****************************************************************************************
  1277.  *                                                                                       *
  1278.  *  Function Name : ShowCapacityInfo                                                     *
  1279.  *                                                                                       *
  1280.  *  Purposes      : Show the capacity infomation if the "CapacityInfo" button is select  *
  1281.  *                                                                                       *
  1282.  *  Descriptions  :                                                                      *
  1283.  *                                                                                       *
  1284.  *  Arguments     : (none)                                                               *
  1285.  *                                                                                       *
  1286.  *  Returns       : (none)                                                               *
  1287.  *                                                                                       *
  1288.  *  See also      :                                                                      *
  1289.  *  Creator       : sunzhh 2004-11-10                                                    *
  1290.  *                                                                                       *
  1291. ****************************************************************************************/
  1292. void ShowCapacityInfo(void)
  1293. {
  1294.     #ifdef SPHE8202_ALL_TYPE_CARD_WRITE
  1295.     card_browse_sign = 0; //dingzhy add for not into CardSetBrowse
  1296.     #endif
  1297.     //InfoGui_flag=1;
  1298.     //to get capacity information
  1299.     StorageGetCapacityInfo();
  1300.     
  1301.     //init region
  1302.     osd_init_MediaswitchGUI();
  1303.     
  1304.     BYTE *title_str="CAPACITY INFO";
  1305.     osd_draw_region_rect(0, 0, 64*4, 40, COLOR_GREEN, 3);
  1306.     osd_DrawRegionString(2, 1, title_str, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION);
  1307.     
  1308.     //draw background of the region
  1309.     SetOsdCol(FUNCTION_REGION, FUNCTION_REGION, 0,__palette4F(192,192, 192, 0xe0));
  1310.     osd_DrawRegionString(2, 1, title_str, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION);
  1311.     psprintf(linebuf, "TOTAL: %5dM", uiTotalCapacity);
  1312.     
  1313.     //draw string on button
  1314.     osd_DrawRegionString(1,8+5,linebuf, COLOR_WHITE, COLOR_GRAYWHITE,3);        
  1315.     psprintf(linebuf, "USED: %6dM", uiUsedCapacity);
  1316.     
  1317.     //draw string on button
  1318.     osd_DrawRegionString(1,2*8+5,linebuf, COLOR_WHITE, COLOR_GRAYWHITE,3);
  1319.     psprintf(linebuf, "REMAIN: %4dM", uiRemainCapacity);
  1320.     
  1321.     //draw string on button
  1322.     osd_DrawRegionString(1,3*8+5,linebuf, COLOR_WHITE, COLOR_GRAYWHITE,3);
  1323. }
  1324. /****************************************************************************************
  1325.  *                                                                                       *
  1326.  *                           New input table related functions                           *
  1327.  *                                                                                       *
  1328. ****************************************************************************************/
  1329. //Start,New input table related functions.
  1330. void input_str_clear_HL(void)
  1331. {
  1332.     int i;
  1333.     BYTE *str[] = {   " A  B  C  D  E  F  G  H ",
  1334.                       " I  J  K  L  M  N  O  P ",
  1335.                       " Q  R  S  T  U  V  W  X ",
  1336.                       " Y  Z  1  2  3  4  5  6 ",
  1337.                       " 7  8  9  0  ~  _  -  \",
  1338.                       "                        ",                    
  1339.                       "    EXIT        ENTER   "};
  1340.     for(i=0;i<=6;i++)
  1341.         osd_DrawRegionString(4, (i+1)*8+5, str[i], COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION);                     
  1342. }
  1343. /****************************************************************************************/
  1344. void input_HL_ItemStr(BYTE itemstr_index )
  1345. {
  1346.     BYTE itemstr_xstart = 0;
  1347.     BYTE itemstr_ystart = 0;
  1348.     BYTE x,y;   
  1349.     x = itemstr_index % 8;
  1350.     y = itemstr_index / 8;
  1351.     itemstr_xstart = 5  + x * 3;
  1352.     itemstr_ystart = 13 + y * 8;
  1353.     osd_DrawRegionString(itemstr_xstart, itemstr_ystart,Item_Str[itemstr_index], COLOR_WHITE, COLOR_DBLUE,FUNCTION_REGION);      
  1354. }
  1355. /****************************************************************************************/
  1356. void input_str_func_up(void)
  1357. {
  1358.     input_str_clear_HL();
  1359.     Str_Index_x--;
  1360.     if(Str_Index_x<-1)
  1361.     {
  1362.         Str_Index_x=-1;        
  1363.     }
  1364.     else if(Str_Index_x==-1)
  1365.     {
  1366.         
  1367.     }
  1368.     else if(Str_Index_x>-1)
  1369.     {
  1370.         input_HL_ItemStr(Item_Num[Str_Index_x][Str_Index_y]);
  1371.     }
  1372. }
  1373. /****************************************************************************************/
  1374. void input_str_func_down(void)
  1375. {   
  1376.     input_str_clear_HL();
  1377.     Str_Index_x++;
  1378.     if((Str_Index_x==5)&&(Str_Index_y<4))
  1379.     {
  1380.         Exit_Enter_flag=1;
  1381.         osd_DrawRegionString(8, 7*8+5, StrExit, COLOR_WHITE, COLOR_DBLUE, FUNCTION_REGION);
  1382.     }
  1383.     else if((Str_Index_x==5)&&(Str_Index_y>=4))
  1384.     {
  1385.         Exit_Enter_flag=2;
  1386.         osd_DrawRegionString(20, 7*8+5, StrEnter, COLOR_WHITE, COLOR_DBLUE, FUNCTION_REGION);
  1387.     }
  1388.     else if(Str_Index_x>5)
  1389.     {     
  1390.         Str_Index_x=5;
  1391.         if(Exit_Enter_flag==1) 
  1392.         {
  1393.             osd_DrawRegionString(8, 7*8+5, StrExit, COLOR_WHITE, COLOR_DBLUE, FUNCTION_REGION);
  1394.         }
  1395.         else if(Exit_Enter_flag==2) 
  1396.         {
  1397.             osd_DrawRegionString(20, 7*8+5, StrEnter, COLOR_WHITE, COLOR_DBLUE, FUNCTION_REGION);
  1398.         }
  1399.         
  1400.     }
  1401.     else if(Str_Index_x<5)
  1402.     {      
  1403.         input_HL_ItemStr(Item_Num[Str_Index_x][Str_Index_y]);
  1404.     }
  1405. }
  1406. /****************************************************************************************/
  1407. void input_str_func_left(void)
  1408. {        
  1409.     if(Str_Index_x==-1)
  1410.     {        
  1411.         Max_input_flag=0;
  1412.         input_xoffset--;
  1413.         printf("=============input_xoffset:%d=================n",input_xoffset);
  1414.         if(input_xoffset<0)
  1415.         { 
  1416.             Max_left_flag=1;
  1417.             input_xoffset=0;
  1418.         }
  1419.         else if(Max_left_flag!=1)
  1420.         {           
  1421.             GetString[input_xoffset]=' ';
  1422.             printf("===GetString:%s========n",GetString); 
  1423.             osd_DrawRegionString(14+input_xoffset, 1, " ", COLOR_DBLUE,COLOR_GREEN, FUNCTION_REGION); 
  1424.         }   
  1425.         return;
  1426.     }
  1427.     input_str_clear_HL();  
  1428.     if((Str_Index_x==5)&&(Exit_Enter_flag==2))
  1429.     {
  1430.         Exit_Enter_flag=1;
  1431.         osd_DrawRegionString(8, 7*8+5, StrExit, COLOR_WHITE, COLOR_DBLUE, FUNCTION_REGION);
  1432.     }  
  1433.     else if((Str_Index_x==5)&&(Exit_Enter_flag==1))
  1434.     {       
  1435.         osd_DrawRegionString(8, 7*8+5, StrExit, COLOR_WHITE, COLOR_DBLUE, FUNCTION_REGION);
  1436.     }  
  1437.     else if(Str_Index_x<5)
  1438.     {     
  1439.         Str_Index_y--;
  1440.         if(Str_Index_y<0) Str_Index_y=0;
  1441.         input_HL_ItemStr(Item_Num[Str_Index_x][Str_Index_y]);
  1442.     }
  1443. }
  1444. /****************************************************************************************/
  1445. void input_str_func_right(void)
  1446. {     
  1447.     if(Str_Index_x==-1)
  1448.     {   
  1449.         if(input_xoffset>7)
  1450.         {
  1451.             Max_input_flag=1;
  1452.             input_xoffset=7;
  1453.         }
  1454.         else if((input_xoffset<=7)&&(Max_input_flag!=1))
  1455.         {
  1456.             GetString[input_xoffset]=' ';
  1457.             printf("===GetString:%s========n",GetString); 
  1458.             osd_DrawRegionString(14+input_xoffset, 1, " ", COLOR_DBLUE,COLOR_GREEN, FUNCTION_REGION); 
  1459.         }
  1460.         input_xoffset++;
  1461.         return;
  1462.     }    
  1463.     input_str_clear_HL();  
  1464.     if((Str_Index_x==5)&&(Exit_Enter_flag==1))
  1465.     {
  1466.         Exit_Enter_flag=2;
  1467.         osd_DrawRegionString(20, 7*8+5, StrEnter, COLOR_WHITE, COLOR_DBLUE, FUNCTION_REGION);
  1468.     }     
  1469.     else  if((Str_Index_x==5)&&(Exit_Enter_flag==2))
  1470.     {      
  1471.         osd_DrawRegionString(20, 7*8+5, StrEnter, COLOR_WHITE, COLOR_DBLUE, FUNCTION_REGION);
  1472.     }     
  1473.     else if(Str_Index_x<5)
  1474.     {     
  1475.         Str_Index_y++;
  1476.         if(Str_Index_y>7) Str_Index_y=7;
  1477.         input_HL_ItemStr(Item_Num[Str_Index_x][Str_Index_y]);
  1478.     }
  1479. }
  1480. /****************************************************************************************/
  1481. void input_str_func_select(void)
  1482. {
  1483.     BYTE Str_ID=0;     
  1484.     Max_left_flag=0;
  1485.     if((Str_Index_x==5)&&(Exit_Enter_flag==1))
  1486.     {
  1487.         input_str_func_exit();
  1488.         return;
  1489.     } 
  1490.     if((Str_Index_x==5)&&(Exit_Enter_flag==2))
  1491.     {
  1492.         input_str_func_enter();
  1493.         
  1494.         //added by wangwei,2005-1-13 16:33
  1495.         full_scrn &= (~INPUT_TBL);//for release the IR
  1496.         osd_init();
  1497.         
  1498.         //for debug
  1499.         int i = 0;
  1500.         for(;i<8;i++)
  1501.         {
  1502.             printf("++++++++++++++++++++++++++++++++ GetString[%x] = %x+++++++++++++n",i,GetString[i]);
  1503.         }
  1504.         
  1505.         return;
  1506.     }   
  1507.     Str_ID=Item_Num[Str_Index_x][Str_Index_y];
  1508.     if(input_xoffset>7)
  1509.     {
  1510.         Max_input_flag=1;
  1511.         input_xoffset=7;
  1512.     }
  1513.     else if((input_xoffset<=7)&&(Max_input_flag!=1))
  1514.     {
  1515.         Str_temp=Item_Str[Str_ID];
  1516.         GetString[input_xoffset]=*Str_temp;
  1517.         osd_DrawRegionString(14+input_xoffset, 1, Item_Str[Str_ID], COLOR_DBLUE,COLOR_LBLUE, FUNCTION_REGION);
  1518.     }
  1519.     input_xoffset++;
  1520. }
  1521. /****************************************************************************************/
  1522. void input_str_func_exit(void)
  1523. {
  1524.      input_str_clear_variable();
  1525.      full_scrn &= (~INPUT_TBL);//for release the IR
  1526.  osd_init();    
  1527. }
  1528. /****************************************************************************************/
  1529. void input_str_func_enter(void)
  1530. {
  1531.     char  NullStr[9] = {"        "};
  1532.     if(strcmp(GetString, NullStr)==0)//input nothing
  1533.         ShowWarning("PLEASE INPUT A NAME.");
  1534.     else
  1535.     {
  1536.         if((pFsJpeg->gifsState == FS_STATE_INIT) && (pFsJpeg->ControlArea == CNT_AREA_NEWBUTTON))
  1537.             CreateDir();
  1538.         else if((pFsJpeg->gifsState == FS_STATE_INIT) && (pFsJpeg->ControlArea == CNT_AREA_RENAMEBUTTON))
  1539.             RenameFileDir();
  1540.     }
  1541.     FileModeGUI_Refresh();
  1542.     FileMode_DirList(pFsJpeg->dir_current);
  1543.     pFsJpeg->gifsFuncBtn = 0;
  1544. }
  1545. /****************************************************************************************/
  1546. void input_str_clear_variable(void)
  1547. {
  1548.     int i;
  1549.     for(i=0;i<8;i++)
  1550.        GetString[i]=' ';
  1551.     Str_Index_x=0;
  1552.     Str_Index_y=0;
  1553.     Exit_Enter_flag=0;
  1554.     Max_input_flag=0;
  1555.     Max_left_flag=0;
  1556.     input_xoffset=0;    
  1557. }
  1558. //End,New input table related functions.
  1559. /****************************************************************************************
  1560.  *                                                                                       *
  1561.  *  Function Name : input_page                                                           *
  1562.  *                                                                                       *
  1563.  *  Purposes      : Draw the input page after select the rename button                   *
  1564.  *                                                                                       *
  1565.  *  Descriptions  :                                                                      *
  1566.  *                                                                                       *
  1567.  *  Arguments     : (none)                                                               *
  1568.  *                                                                                       *
  1569.  *  Returns       : (none)                                                               *
  1570.  *                                                                                       *
  1571.  *  See also      :                                                                      *
  1572.  *                                                                                       *
  1573. ****************************************************************************************/
  1574. void input_page(void)
  1575. {
  1576.     //#ifdef NEW_INPUT_MENU   
  1577.     BYTE *title_str2="INPUT NAME:";
  1578.     
  1579.     osd_init_periphGUI();
  1580.     
  1581.     osd_draw_region_rect(0, 0,   64*8, 40, COLOR_GREEN, 3);
  1582.     osd_draw_region_rect(0, 278, 64*8, 10, COLOR_GREEN, 3);
  1583.     
  1584.     //for test,marked by wangwei,2005-1-13 10:28
  1585.     /*if(KeyID == BUTTON_COPY)
  1586.     osd_DrawRegionString(2, 1, title_str1, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION);
  1587.     else if(KeyID == BUTTON_RENAME)
  1588.     osd_DrawRegionString(2, 1, title_str2, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION);*/
  1589.     
  1590.     //for test,added by wangwei,2005-1-13 10:29
  1591.     osd_DrawRegionString(2, 1, title_str2, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION);
  1592.     osd_DrawRegionString(14, 1, " ", COLOR_DBLUE,COLOR_LBLUE, FUNCTION_REGION);
  1593. SetOsdCol(FUNCTION_REGION, FUNCTION_REGION, 0,__palette4F(192,192, 192, 0xe0));//draw background of the region
  1594.     
  1595.     //init variable
  1596.     input_str_clear_variable();
  1597.     input_str_clear_HL();
  1598.     
  1599.     //HL first itemstr
  1600.     input_HL_ItemStr(0);
  1601.     
  1602.     //for IR U/D/L/R/Sel input str func setting,for test,marked by wangwei,2005-1-13 10:58
  1603.     //SetFullscrnCmdFuncPtr(input_str_func_up, input_str_func_down, input_str_func_left, input_str_func_right, input_str_func_select);
  1604. }
  1605. /****************************************************************************************
  1606.  *                                                                                       *
  1607.  *                                                                                       *
  1608.  *                                           Buttons                                     *
  1609.  *                                                                                       *
  1610.  *                                                                                       *
  1611. ****************************************************************************************/
  1612. void ButtonCopy(void)
  1613. {
  1614.     Draw_File_Mode_Button();            
  1615.     FATCopy();       
  1616.     pFsJpeg->ControlArea = old_ControlArea;                      
  1617.     pFsJpeg->gifsFuncBtn = 0;                                     
  1618. }
  1619. /****************************************************************************************/
  1620. void ButtonDelete(void)
  1621. {
  1622.     printf("n============ButtonDelete================n");     
  1623.     Draw_File_Mode_Button();                
  1624.     FATDelete();            
  1625.     pFsJpeg->ControlArea = old_ControlArea;                                         
  1626.     pFsJpeg->gifsFuncBtn = 0;                                                        
  1627. }    
  1628. /****************************************************************************************/
  1629. void ButtonNew(void)
  1630. {
  1631.     printf("n============ButtonNew================n");     
  1632.     Draw_File_Mode_Button();                    
  1633.     full_scrn |= INPUT_TBL;
  1634.     input_page();
  1635.     pFsJpeg->gifsFuncBtn = 0;                
  1636. }  
  1637. /****************************************************************************************/
  1638. void ButtonRename(void)
  1639. {
  1640.     printf("n============ButtonRename================n");     
  1641.     Draw_File_Mode_Button();                    
  1642.     full_scrn |= INPUT_TBL;
  1643.     input_page();
  1644.     pFsJpeg->gifsFuncBtn = 0;                
  1645. }
  1646. /****************************************************************************************/
  1647. void ButtonFormat(void)
  1648. {
  1649.     printf("n============ButtonFormat================n");     
  1650.     Draw_File_Mode_Button();                    
  1651.     ShowWarning("FORMATING...");                       
  1652.     FSFormat();                  
  1653.     ShowWarning("FORMAT IS OK.");                                            
  1654.     pFsJpeg->gifsFuncBtn = 0;                                                           
  1655. }
  1656. /****************************************************************************************/
  1657. void ButtonCapacity(void)
  1658. {
  1659.     printf("n============ButtonCapacity================n");  
  1660.     Draw_File_Mode_Button();                    
  1661.     if(full_scrn & STRG_INFO)
  1662.     {
  1663.         full_scrn &= (~STRG_INFO);//for release the IR
  1664.         osd_init();
  1665.         ShowHL();
  1666.     }
  1667.     else
  1668.     {
  1669.         full_scrn |= STRG_INFO;
  1670.         //show USB & CARD information
  1671.         ShowCapacityInfo();
  1672.     }
  1673.     pFsJpeg->gifsFuncBtn = 0;            
  1674. }
  1675. /****************************************************************************************
  1676. *                                                                                        *
  1677. *  Function Name : DrawProgressBarInit                                                   *
  1678. *                                                                                        *
  1679. *  Purposes      : Initialize draw process bar.                                          *
  1680. *                                                                                        *
  1681. *  Descriptions  : Initialize draw process bar. to clear the backgroud of the            *
  1682. *                  the process bar & draw the back rut of the process bar.               *
  1683. *                                                                                        *
  1684. *  Arguments     : (none)                                                                *
  1685. *                                                                                        *
  1686. *  Returns       : (none)                                                                *
  1687. *                                                                                        *
  1688. *  See also      :                                                                       *
  1689. *                                                                                        *
  1690. ****************************************************************************************/
  1691. void DrawProgressBarInit(void)
  1692. {
  1693.     //cover bottom buttons.
  1694.     FSGUI_FillFrameBuf(FS_BOTTOM_AREA_X_START, FS_BOTTOM_AREA_Y_START, FS_BOTTOM_AREA_X_SIZE, FS_BOTTOM_AREA_Y_SIZE, BK_GROUNDY, BK_CRCB);
  1695.     //draw character.
  1696.     strcpy(linebuf, "PROGRESS");
  1697.     FSGUI_ShowString(FS_BOTTOM_AREA_X_START + 15, FS_BOTTOM_AREA_Y_START + 14, linebuf, FS_FONTCOLOR_FILE_Y1, FS_FONTCOLOR_FILE_CrCb1);
  1698.     //draw process back rut. 
  1699.     DrawRect(FS_BOTTOM_AREA_X_START + 90, FS_BOTTOM_AREA_Y_START + 13, FS_BOTTOM_AREA_X_SIZE - 101, FS_BOTTOM_AREA_Y_SIZE - 35, 1, BK_GROUNDY, BK_CRCB);
  1700.     //draw process back bar.
  1701.     int i;
  1702.     for(i=0;i<192;i+=4)
  1703.         FSGUI_FillFrameBuf(FS_BOTTOM_AREA_X_START + 94 + i, FS_BOTTOM_AREA_Y_START + 17, 3, FS_BOTTOM_AREA_Y_SIZE - 42, RGB2Y(0,0,0), RGB2CrCb(0,0,0));
  1704. }
  1705. /****************************************************************************************
  1706. *                                                                                        *
  1707. *  Function Name : Refresh                                                               *
  1708. *                                                                                        *
  1709. *  Purposes      : Draw process bar.                                                     *
  1710. *                                                                                        *
  1711. *  Descriptions  : Draw process bar.                                                     *
  1712. *                                                                                        *
  1713. *  Arguments     :                                                                       *
  1714. *                  copy_process : The percentage of copying action that have been        *
  1715. *                                 already completed, ranges from 0 to 100.               *
  1716. *                                                                                        *
  1717. *  Returns       : (none)                                                                *
  1718. *                                                                                        *
  1719. *  See also      :                                                                       *
  1720. *                                                                                        *
  1721. ****************************************************************************************/
  1722. void Refresh(BYTE copy_process)
  1723. {
  1724.     int i;
  1725.     if(copy_process<=100)  
  1726.         {
  1727.             psprintf(linebuf, "COPYING FILE[%d%s]", copy_process,"%");   
  1728.             //FSGUI_UpdateInfoArea(linebuf);
  1729.             //draw process.
  1730.             for(i=0;i<copy_process*2-8;i+=4){
  1731.                 FSGUI_FillFrameBuf(FS_BOTTOM_AREA_X_START + 94 + i, FS_BOTTOM_AREA_Y_START + 17, 3, FS_BOTTOM_AREA_Y_SIZE - 42, RGB2Y(45,84,229), RGB2CrCb(45,84,229));
  1732.                 FSGUI_FillFrameBuf(FS_BOTTOM_AREA_X_START + 94 + i, FS_BOTTOM_AREA_Y_START + 21, 3, FS_BOTTOM_AREA_Y_SIZE - 46, RGB2Y(20,47,149), RGB2CrCb(20,47,149));
  1733.             }
  1734.         }
  1735.         if(copy_process >= 100)
  1736.         {
  1737.             psprintf(linebuf, "COPYING FILE[100%s]", "%");
  1738.             //lijd for updata copy file name 2004-11-16 20:26
  1739.             delay_srv_10ms(100);
  1740.             //FSGUI_UpdateInfoArea(linebuf);  
  1741.             //FSGUI_UpdateInfoArea(linebuf);
  1742.             FSGUI_FillFrameBuf(FS_BOTTOM_AREA_X_START, FS_BOTTOM_AREA_Y_START,FS_BOTTOM_AREA_X_SIZE, FS_BOTTOM_AREA_Y_SIZE, BK_GROUNDY, BK_CRCB);   // lijd 2004-11-16 14:52
  1743.         }
  1744. }
  1745. /****************************************************************************************/
  1746. #endif//FILE_MODE_WRITE