periphGUI.c
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:62k
源码类别:

DVD

开发平台:

C/C++

  1. /***************************************************************
  2.  *
  3.  * File Name :  periphGUI.c
  4.  * 
  5.  * Discription:
  6.  *     Provide an interface for operations related with peripheral
  7.  *     Especially for UDisk and CF card 
  8.  *
  9.  * Creator:  liweihua
  10.  * Date   :  2003-10-29 20:18
  11.  * Update :  sunzhh 2004-11-15 
  12.  * modify :  linrc  20041204 rename Card*->FS*
  13.  ***************************************************************/
  14. #include "user_init.h"
  15. #include "global.h"
  16. #include "memmap0.h"
  17. #include "ircmd.h"
  18. #include "types.h"
  19. #include "memcfg.h"
  20. #include "framebuf.h"
  21. #include "memmap.h"
  22. #include "osd.h"
  23. #include "fsNav.h"
  24. #define NEW_INPUT_MENU //lijd 2004-12-20 16:15 
  25. #ifdef SPHE8202_ALL_TYPE_CARD_WRITE
  26. BYTE card_browse_sign = 1;
  27. #endif
  28. #if defined(FAT_Write_UI)||defined(CF_CARD_WRITE)
  29. #include "cardfs.h"
  30. //extern int CardSchedule(BYTE copy_mode);
  31. extern int FSSchedule(BYTE copy_mode);
  32. extern int CARDIsPlugIn(void);
  33. extern CARD_INFO   cardP;
  34. BYTE read_card_sign=0;
  35. BYTE flag_cd2cf=0, flag_cf2cd=0;
  36. BYTE InfoGui_flag=0;
  37. int remain_capacity;
  38. extern UINT32 zeroFAT_cnt;
  39. #ifdef FAT_Write_File_System  //added by wangwei,2004-11-15 13:29
  40. extern void StorageGetCapacityInfo(void);
  41. extern UINT32 uiTotalCapacity;
  42. extern UINT32 uiUsedCapacity;
  43. extern UINT32 uiRemainCapacity;
  44. #endif //FAT_WRITE_FILE_SYSTEM
  45. #ifdef STORAGE_WRITE_GUI
  46.     #ifdef CARD_SETUP_TYPE_3  
  47. BYTE  *stringMediaswitch[]={" ","UDISK","CF CARD","SD/MMC","MS/MS PRO","SMC"};
  48. #else 
  49. BYTE  *stringMediaswitch[]={" ","UDISK","SD/MMC","MS/MS PRO"};
  50. #endif
  51. #elif defined(CARD_WRITE_GUI)
  52.     #if defined(CARD_SETUP_TYPE_3)   
  53.     BYTE  *stringMediaswitch[]={" ","CF CARD","SD/MMC","MS/MS PRO","SMC"};
  54.     #else 
  55.     BYTE  *stringMediaswitch[]={" ","SD/MMC","MS/MS PRO"};
  56.     #endif
  57. #endif
  58. #ifdef STORAGE_WRITE_GUI
  59. BYTE  *string[]={"NO UDISK/CARD","CDROM TO UDISK","UDISK TO CDROM","COPY FILE TO","DELETE FILE","FORMAT","RENAME FILE","CAPACITY INFO"};
  60. #elif defined(CF_CARD_WRITE)||defined(CARD_WRITE_GUI)
  61. BYTE  *string[]={"NO CARD","CDROM TO CARD","CARD TO CDROM","COPY THE FILE","DELETE FILE","FORMAT","RENAME FILE","CAPACITY INFO"};
  62. #else
  63. BYTE  *string[]={"NO UDISK","CDROM TO UDISK","UDISK TO CDROM","COPY FILE TO","DELETE FILE","FORMAT","RENAME FILE","CAPACITY INFO"};
  64. #endif
  65. #define OSD_FONT_HEIGHT 24
  66. #define FUNCTION_REGION 3
  67. #define MESSAGE_REGION 2
  68. #define COLOR_WHITE         2
  69. #define COLOR_GRAY     3
  70. #define COLOR_GRAYWHITE     14
  71. #define COLOR_YELLOW     7
  72. #define COLOR_YELLOWGREEN   9
  73. #define COLOR_DBLUE     4
  74. #define COLOR_LBLUE         0
  75. #define COLOR_GREEN         13
  76. #define BUTTON_UP 0
  77. #define BUTTON_DOWN     1
  78. #define BUTTON_LEN 18
  79. #define NO_PERIPHRAL 0
  80. #define BUTTON_CD2P 1
  81. #define BUTTON_P2CD 2
  82. #define BUTTON_COPY 3
  83. #define BUTTON_DELETE 4
  84. #define BUTTON_FORMAT 5
  85. #define BUTTON_RENAME 6
  86. #define BUTTON_CAPACITY 7
  87. #ifdef FAT_Write_UI
  88. BYTE Switch_flag=0;
  89. BYTE SwitchID;
  90. BYTE Select_Media;
  91. #define Media_UDISK     1
  92. #define Media_CF 2
  93. #define Media_SD 3
  94. #define Media_MS 4
  95. #define Media_SMC 5
  96. #ifdef CARD_SETUP_TYPE_3
  97. #define BUTTON_UDISK 1
  98. #define BUTTON_CF 2
  99. #define BUTTON_SD 3
  100. #define BUTTON_MS 4
  101. #define BUTTON_SMC 5
  102. #else//if defined(CARD_SETUP_TYPE_4)
  103. #define BUTTON_UDISK 1
  104. #define BUTTON_SD 2
  105. #define BUTTON_MS 3
  106. #endif
  107. #endif
  108. #define COPY_ROOTDIR   1   //copy file to root dir
  109. #define COPY_EXISTING   2   //copy file to existing dir
  110. #define COPY_NEWDIR   3   //created new dir and copy file to the new dir
  111. #define ERROR_MESSAGE 0
  112. #define PFUN_WRITE 1
  113. #define PFUN_DELETE 2
  114. #define PFUN_FORMAT 3
  115. #define PFUN_RENAME 4
  116. #define PFUN_COPYING 5
  117. #define P_SPACEFULL  6
  118. #define P_SPACEEMPTY  7
  119. #define P_INPUT  8
  120. #define P_NOMATCH    9
  121. #define P_DIREXISTING     10//add 2003-12-22
  122. #define  COPY_ROOTDIR    1   //copy file to root dir
  123. #define  COPY_EXSITING   2   //copy file to existing dir
  124. #define  COPY_NEWDIR    3   //created new dir and copy file to the new dir
  125. #define __palette4F(G,B,R,A) 
  126.         ( ((UINT32)((G)&0xff)<<24)|((UINT32)((B)&0xff)<<16)|((UINT32)((R)&0xff)<<8)|(A&0xff) ) 
  127. extern void osd_init_MediaswitchGUI(void);
  128. extern void osd_init_periphGUI(void);
  129. extern void osd_DrawRegionString(BYTE xStart, BYTE yStart, BYTE *str, BYTE fontColor, BYTE bkColor, BYTE r);
  130. extern void osd_draw_button(BYTE xStart, BYTE yStart, BYTE xLen, BYTE color, BYTE bDown, BYTE r);
  131. extern void osd_draw_region_rect(UINT32 xStart, UINT32 yStart, UINT32 xLen, UINT32 yLen, BYTE bkColor, BYTE r);
  132. extern int AVD_SetMediaInterrupt(void);
  133. BYTE sign_PFun=0;
  134. BYTE    *stringcopy[]={" ","ROOT DIR","EXISTING DIR","CREATE DIR"};
  135. BYTE KeyID;
  136. BYTE CopyID=0;
  137. BYTE level=0;
  138. BYTE input_flag=0;
  139. BYTE pressnum=10, PressID=5,pressnum_flag=0,xoffset=0;
  140. char *temp;
  141. char getstring[8]={};
  142. /***************************************************************************
  143.  *  Function Name: Set_Button                                              *
  144.  *  Purposes: Only for drawing the function button                         *
  145.  *  Arguments: none                                                        *
  146.  *  Returns: none                                                          *
  147.  *  Update:  sunzhh 2004-11-10                                             *
  148.  **************************************************************************/
  149. void Set_Button(void)
  150. {
  151. BYTE item;
  152.     if(media_type==MEDIA_CD)
  153. {
  154.         osd_DrawRegionString(2, BUTTON_CD2P*8+3, string[BUTTON_CD2P], COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION); //draw string on button
  155.         osd_DrawRegionString(2, BUTTON_P2CD*8+3, string[BUTTON_P2CD], COLOR_GRAY, COLOR_GRAYWHITE, FUNCTION_REGION); //draw string on button
  156. osd_DrawRegionString(2, BUTTON_COPY*8+3, string[BUTTON_COPY], COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION); //draw string on button
  157. for(item=BUTTON_DELETE; item<=BUTTON_RENAME; item++)//invalidate the latter three
  158. {
  159. osd_DrawRegionString(2, item*8+3, string[item], COLOR_GRAY, COLOR_GRAYWHITE, FUNCTION_REGION); //draw string on button
  160. }
  161. osd_DrawRegionString(2, BUTTON_CAPACITY*8+3, string[BUTTON_CAPACITY], COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION); //draw string on button
  162. }
  163.     if(media_type==MEDIA_CARD)
  164. {
  165.         //for copy gray
  166.         osd_DrawRegionString(2, BUTTON_CD2P*8+3, string[BUTTON_CD2P], COLOR_GRAY, COLOR_GRAYWHITE, FUNCTION_REGION); //draw string on button
  167. osd_DrawRegionString(2, BUTTON_COPY*8+3, string[BUTTON_COPY], COLOR_GRAY, COLOR_GRAYWHITE, FUNCTION_REGION); //draw string on button
  168.         osd_DrawRegionString(2, BUTTON_P2CD*8+3, string[BUTTON_P2CD], COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION); //draw string on button
  169.      for(item=BUTTON_DELETE; item<=BUTTON_RENAME; item++)//all six are ok
  170.      {
  171.          osd_DrawRegionString(2, item*8+3, string[item], COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION); //draw string on button
  172.         }
  173. osd_DrawRegionString(2, BUTTON_CAPACITY*8+3, string[BUTTON_CAPACITY], COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION); //draw string on button         
  174.     }
  175. }
  176. /***************************************************************************
  177.  *  Function Name: Set_MediaSwitch_Button                                  *
  178.  *  Purposes: Only for drawing the meia button to switch                   *
  179.  *  Arguments: none                                                        *
  180.  *  Returns: none                                                          *
  181.  *  Create:  sunzhh 2004-11-10                                             *
  182.  **************************************************************************/
  183. #if defined(STORAGE_WRITE_GUI)||defined(CARD_WRITE_GUI)
  184. void Set_MediaSwitch_Button(void)
  185. {    
  186.    //draw string on button                         
  187.         if(detect_type & USB_DEVICE)   //&&(detect_type & SD_CARD_DEVICE)) 
  188.             osd_DrawRegionString(1, BUTTON_UDISK*8+5, stringMediaswitch[BUTTON_UDISK], COLOR_WHITE, COLOR_GRAYWHITE,3); //draw string on button        
  189.         else 
  190.             osd_DrawRegionString(1, BUTTON_UDISK*8+5, stringMediaswitch[BUTTON_UDISK], COLOR_GRAY, COLOR_GRAYWHITE,3); //draw string on button        
  191.         #ifdef CARD_SETUP_TYPE_3   //256Pin 16bit Non_share mode All card. 
  192.         if(detect_type & CF_CARD_DEVICE) 
  193.             osd_DrawRegionString(1, BUTTON_CF*8+5, stringMediaswitch[BUTTON_CF], COLOR_WHITE, COLOR_GRAYWHITE,3); //draw string on button                       
  194.         else
  195.             osd_DrawRegionString(1, BUTTON_CF*8+5, stringMediaswitch[BUTTON_CF], COLOR_GRAY, COLOR_GRAYWHITE,3); //draw string on button                       
  196.         #endif
  197.         if(detect_type & SD_CARD_DEVICE) 
  198.             osd_DrawRegionString(1, BUTTON_SD*8+5, stringMediaswitch[BUTTON_SD], COLOR_WHITE, COLOR_GRAYWHITE,3); //draw string on button        
  199.         else 
  200.             osd_DrawRegionString(1, BUTTON_SD*8+5, stringMediaswitch[BUTTON_SD], COLOR_GRAY, COLOR_GRAYWHITE,3); //draw string on button        
  201.         if(detect_type & MS_CARD_DEVICE)
  202.             osd_DrawRegionString(1, BUTTON_MS*8+5, stringMediaswitch[BUTTON_MS], COLOR_WHITE, COLOR_GRAYWHITE,3); //draw string on button        
  203.         else
  204.             osd_DrawRegionString(1, BUTTON_MS*8+5, stringMediaswitch[BUTTON_MS], COLOR_GRAY, COLOR_GRAYWHITE,3); //draw string on button         
  205.         #ifdef CARD_SETUP_TYPE_3   //256Pin 16bit Non_share mode All card.       
  206.         if(detect_type & SMC_CARD_DEVICE) 
  207.             osd_DrawRegionString(1, BUTTON_SMC*8+5, stringMediaswitch[BUTTON_SMC], COLOR_WHITE, COLOR_GRAYWHITE,3); //draw string on button        
  208.         else
  209.             osd_DrawRegionString(1, BUTTON_SMC*8+5, stringMediaswitch[BUTTON_SMC], COLOR_GRAY, COLOR_GRAYWHITE,3); //draw string on button                     
  210.         #endif 
  211. }
  212. #endif        
  213. /***************************************************************************
  214.  *  Function Name: highlight_button                                              *
  215.  *  Purposes: highlight the mainmenu button that will select               *
  216.  *  Arguments: selectID                                                        *
  217.  *  Returns: none                                                          *
  218.  *  Update:  sunzhh 2004-11-10                                             *
  219.  **************************************************************************/
  220. void highlight_button(BYTE selectID)
  221. {
  222.     #if defined(STORAGE_WRITE_GUI)||defined(CARD_WRITE_GUI)
  223.     if(Switch_flag==1)
  224.     {
  225.         Set_MediaSwitch_Button();
  226.     switch(selectID)
  227.     {
  228.     case BUTTON_UDISK:
  229.                 osd_DrawRegionString(1, BUTTON_UDISK*8+5, stringMediaswitch[BUTTON_UDISK], COLOR_WHITE, COLOR_YELLOWGREEN,3); //draw string on button     
  230.     break;                
  231.             #ifdef CARD_SETUP_TYPE_3   //256Pin 16bit Non_share mode All card. 
  232.     case BUTTON_CF:
  233.                 osd_DrawRegionString(1, BUTTON_CF*8+5, stringMediaswitch[BUTTON_CF], COLOR_WHITE, COLOR_YELLOWGREEN,3); //draw string on button         
  234.     break;
  235.             #endif
  236.             case BUTTON_SD:
  237.                 osd_DrawRegionString(1, BUTTON_SD*8+5, stringMediaswitch[BUTTON_SD], COLOR_WHITE, COLOR_YELLOWGREEN,3); //draw string on button        
  238.     break;
  239.             case BUTTON_MS:
  240.                 osd_DrawRegionString(1, BUTTON_MS*8+5, stringMediaswitch[BUTTON_MS], COLOR_WHITE, COLOR_YELLOWGREEN,3); //draw string on button         
  241.     break;
  242.             #ifdef CARD_SETUP_TYPE_3   //256Pin 16bit Non_share mode All card.       
  243.             case BUTTON_SMC:
  244.                 osd_DrawRegionString(1, BUTTON_SMC*8+5, stringMediaswitch[BUTTON_SMC], COLOR_WHITE, COLOR_YELLOWGREEN,3); //draw string on button        
  245.     break;
  246.             #endif 
  247.     }        
  248.     }
  249.     else
  250.     #endif 
  251.     {      
  252.     int y;
  253. Set_Button();// back to the default color
  254. switch(selectID)
  255. {
  256. case BUTTON_CD2P:
  257. osd_DrawRegionString(2, BUTTON_CD2P*8+3, string[BUTTON_CD2P], COLOR_WHITE, COLOR_YELLOWGREEN, FUNCTION_REGION);  //draw string on button
  258.             for(y=0;y<3;y++)
  259.                 osd_DrawRegionString(17,(3+y)*8+3,"              ",COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION);
  260. break;
  261. case BUTTON_P2CD:
  262. osd_DrawRegionString(2, BUTTON_P2CD*8+3, string[BUTTON_P2CD], COLOR_WHITE, COLOR_YELLOWGREEN, FUNCTION_REGION);  //draw string on button
  263.             for(y=0;y<3;y++)
  264.                 osd_DrawRegionString(17,(3+y)*8+3,"              ",COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION);
  265. break;
  266. case BUTTON_COPY:
  267. osd_DrawRegionString(2, BUTTON_COPY*8+3, string[BUTTON_COPY], COLOR_WHITE, COLOR_YELLOWGREEN, FUNCTION_REGION);  //draw string on button
  268.             for(y=0;y<3;y++)
  269.             {
  270.                 osd_DrawRegionString(17,(3+y)*8+3,"--",COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION);
  271.                 osd_DrawRegionString(19,(3+y)*8+3,stringcopy[y+1],COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION);
  272.             }
  273. break;
  274. case BUTTON_DELETE:
  275. osd_DrawRegionString(2, BUTTON_DELETE*8+3, string[BUTTON_DELETE], COLOR_WHITE, COLOR_YELLOWGREEN, FUNCTION_REGION);  //draw string on button
  276. break;
  277. case BUTTON_FORMAT:
  278. osd_DrawRegionString(2, BUTTON_FORMAT*8+3, string[BUTTON_FORMAT], COLOR_WHITE, COLOR_YELLOWGREEN, FUNCTION_REGION);  //draw string on button
  279. break;
  280. case BUTTON_RENAME:
  281. osd_DrawRegionString(2, BUTTON_RENAME*8+3, string[BUTTON_RENAME], COLOR_WHITE, COLOR_YELLOWGREEN, FUNCTION_REGION); //draw string on button
  282. break;
  283. case BUTTON_CAPACITY:
  284. osd_DrawRegionString(2, BUTTON_CAPACITY*8+3, string[BUTTON_CAPACITY], COLOR_WHITE, COLOR_YELLOWGREEN, FUNCTION_REGION); //draw string on button
  285.                 for(y=0;y<3;y++)
  286.                     osd_DrawRegionString(17,(3+y)*8+3,"              ",COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION);
  287. break;
  288. }
  289.     }
  290. }
  291. /***************************************************************************
  292.  *  Function Name: highlight_button_all                                              *
  293.  *  Purposes: highlight all the button containing submenu that will select *
  294.  *  Arguments: selectID,  copyID                                                      *
  295.  *  Returns: none                                                          *
  296.  *  Update:  sunzhh 2004-11-10                                             *
  297.  **************************************************************************/
  298. void highlight_button_all(BYTE selectID,BYTE copyID)
  299. {
  300.     if(copyID==0) 
  301.         highlight_button(selectID);
  302.     else 
  303.     {
  304.         highlight_button(selectID);
  305.         osd_DrawRegionString(2, BUTTON_COPY*8+3, string[BUTTON_COPY], COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION);
  306.         osd_DrawRegionString(19,(2+copyID)*8+3,stringcopy[copyID],COLOR_WHITE, COLOR_YELLOWGREEN, FUNCTION_REGION);
  307.     }
  308. }
  309. /***************************************************************************
  310.  *  Function Name: show_mediaswitch                                        *
  311.  *  Purposes: show the media switch menu                                   *
  312.  *  Descriptions:                                                          * 
  313.  *     If there is two media detected at one time,the menu is showing.     * 
  314.  *  Arguments: none                                                        *
  315.  *  Returns: none                                                          *
  316.  *  Create:  sunzhh 2004-11-10                                             *
  317.  **************************************************************************/
  318. #if defined(STORAGE_WRITE_GUI)||defined(CARD_WRITE_GUI)
  319. void show_mediaswitch(void)
  320. {
  321.     Switch_flag=1;
  322.     osd_init_MediaswitchGUI();
  323.     BYTE *title_str="MEDIA SWITCH";
  324.     osd_draw_region_rect(0, 0, 64*4, 40, COLOR_GREEN, 3);
  325.     osd_DrawRegionString(2, 1, title_str, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION);
  326.     SetOsdCol(FUNCTION_REGION, FUNCTION_REGION, 0,__palette4F(192,192, 192, 0xe0)); //draw background of the region
  327. if(storage_type==0)
  328. {
  329. osd_DrawRegionString(8, 1, string[NO_PERIPHRAL], COLOR_DBLUE, COLOR_LBLUE, MESSAGE_REGION);  //draw string on button
  330. delay_1ms(2000);
  331. full_scrn &= (~PERIPHERAL);//for release the IR
  332. osd_init();
  333.                 //if you want not interrupt current play,you can use the followed method//dingzhy
  334.                 //psprintf(RegionValStr[REGION1], "USB/CARD NOT FOUND");  
  335. //PrintOsdMsg(STR_OS_SPACE, REGION1, 1, 1);    
  336. }
  337. else
  338. {
  339.         Set_MediaSwitch_Button();
  340.         level=1;
  341.         input_flag=0;
  342.         xoffset=0;
  343.         CopyID=0;
  344.         InfoGui_flag=0;
  345.         if(detect_type&USB_DEVICE)
  346.         SwitchID=BUTTON_UDISK;
  347.         #ifdef CARD_SETUP_TYPE_3 
  348.         else if(detect_type&CF_CARD_DEVICE)
  349.         SwitchID=BUTTON_CF;
  350.         #endif
  351.      highlight_button(SwitchID);        
  352.     }
  353. }
  354. #endif
  355. /***************************************************************************
  356.  *  Function Name: show_switch                                             *
  357.  *  Purposes: show the function switch menu                                *
  358.  *  Arguments: Select_Media                                                        *
  359.  *  Returns: none                                                          *
  360.  *  Update:  sunzhh 2004-11-10                                             *
  361.  **************************************************************************/
  362. void show_switch(BYTE Select_Media)
  363. {
  364.     BYTE i;
  365.     BYTE Select_Media; 
  366.     if(Switch_flag==0) 
  367.     {     
  368.         if(detect_type==USB_DEVICE)
  369.         Select_Media=Media_UDISK;
  370.         else if(detect_type==CF_CARD_DEVICE) 
  371.         Select_Media=Media_CF;
  372.         else if(detect_type==SD_CARD_DEVICE)
  373.         Select_Media=Media_SD;         
  374.         else if(detect_type==MS_CARD_DEVICE)
  375.         Select_Media=Media_MS;             
  376.         else if(detect_type==SMC_CARD_DEVICE) 
  377.         Select_Media=Media_SMC;
  378.     }
  379.     if(Select_Media==Media_UDISK)
  380.     {      
  381.         string[1]="CDROM TO UDISK";
  382.         string[2]="UDISK TO CDROM";       
  383.     }
  384.     else if(Select_Media==Media_CF)      
  385.     {
  386.         string[1]="CDROM TO CF";
  387.         string[2]="CF TO CDROM";
  388.         string[5]="FORMAT CF";
  389.     }
  390.     else if(Select_Media==Media_SD)
  391.     {      
  392.         string[1]="CDROM TO SD/MMC";
  393.         string[2]="SD/MMC TO CDROM";
  394.         string[5]="FORMAT SD/MMC";
  395.     }
  396.     else if(Select_Media==Media_MS) 
  397.     {     
  398.         string[1]="CDROM TO MS/MS PRO";
  399.         string[2]="MS/MS PRO TO CDROM";
  400.         string[5]="FORMAT MS/MS";
  401.     }
  402.     else if(Select_Media==Media_SMC)
  403.     {      
  404.         string[1]="CDROM TO SMC";
  405.         string[2]="SMC TO CDROM";
  406.         string[5]="FORMAT SMC";
  407.     }                                           
  408.     osd_init_periphGUI();
  409.     osd_draw_region_rect(0, 0, 64*8, 40, COLOR_GREEN, 3);
  410.     osd_draw_region_rect(0, 278, 64*8, 10, COLOR_GREEN, 3);
  411. BYTE *title_str="USER OPERATIONS";
  412. if(storage_type==0)
  413. {
  414. osd_DrawRegionString(8, 1, string[NO_PERIPHRAL], COLOR_DBLUE, COLOR_LBLUE, MESSAGE_REGION);  //draw string on button
  415. delay_1ms(2000);
  416. full_scrn &= (~PERIPHERAL);//for release the IR
  417. osd_init();
  418.                 //if you want not interrupt current play,you can use the followed method//dingzhy
  419. //psprintf(RegionValStr[REGION1], "USB/CARD NOT FOUND");  
  420. //PrintOsdMsg(STR_OS_SPACE, REGION1, 1, 1);    
  421. }
  422. else
  423. {
  424.      osd_DrawRegionString(8, 1, title_str, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION); //draw the note
  425.      SetOsdCol(FUNCTION_REGION, FUNCTION_REGION, 0,__palette4F(192,192, 192, 0xe0)); //draw background of the region
  426.     
  427.      Set_Button();
  428.         level=1;
  429.         input_flag=0;
  430.         xoffset=0;
  431.         CopyID=0;
  432.         Switch_flag=0;
  433.         InfoGui_flag=0;
  434.         if(media_type==MEDIA_CARD)
  435.          KeyID=BUTTON_P2CD;
  436.         else if(media_type==MEDIA_CD)
  437.             KeyID=BUTTON_CD2P;
  438.      highlight_button(KeyID);
  439.         for(i=0;i<8;i++)
  440.             getstring[i]=32;//initialize the getstring for rename,every element is space
  441.     }
  442. }
  443. /***************************************************************************
  444.  *  Function Name: show_CapacityInfo                                       *
  445.  *  Purposes:                                                              *
  446.  *   show the capacity infomation if the "CapacityInfo" button is select   *
  447.  *  Arguments: none                                                        *
  448.  *  Returns: none                                                          *
  449.  *  Create:  sunzhh 2004-11-10                                             *
  450.  **************************************************************************/
  451. void show_CapacityInfo(void)
  452. {
  453.     #ifdef SPHE8202_ALL_TYPE_CARD_WRITE
  454.     card_browse_sign = 0; //dingzhy add for not into CardSetBrowse
  455.     #endif
  456.     InfoGui_flag=1;
  457.     StorageGetCapacityInfo();
  458.     osd_init_MediaswitchGUI();
  459.     BYTE *title_str="CAPACITY INFO";
  460.     osd_draw_region_rect(0, 0, 64*4, 40, COLOR_GREEN, 3);
  461.     osd_DrawRegionString(2, 1, title_str, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION);
  462.     SetOsdCol(FUNCTION_REGION, FUNCTION_REGION, 0,__palette4F(192,192, 192, 0xe0)); //draw background of the region
  463.     osd_DrawRegionString(2, 1, title_str, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION);
  464.     psprintf(linebuf, "TOTAL: %5dM", uiTotalCapacity);
  465.     osd_DrawRegionString(1,8+5,linebuf, COLOR_WHITE, COLOR_GRAYWHITE,3); //draw string on button        
  466.     psprintf(linebuf, "USED: %6dM", uiUsedCapacity);
  467.     osd_DrawRegionString(1,2*8+5,linebuf, COLOR_WHITE, COLOR_GRAYWHITE,3); //draw string on button        
  468.     psprintf(linebuf, "REMAIN: %4dM", uiRemainCapacity);
  469.     osd_DrawRegionString(1,3*8+5,linebuf, COLOR_WHITE, COLOR_GRAYWHITE,3); //draw string on button        
  470. }
  471. /***************************************************************************
  472.  *  Function Name: switch_left                                             *
  473.  *  Purposes: shift highlight using the left key on the switch menu        *
  474.  *  Arguments: none                                                        *
  475.  *  Returns: none                                                          *
  476.  *  Update:  sunzhh 2004-11-10                                             *
  477.  **************************************************************************/
  478. void switch_left()
  479. {
  480.     if(InfoGui_flag==1)
  481.     {
  482.         invalid_key();
  483.     return;    
  484.     }
  485.     
  486.     if(input_flag==0)
  487.     {
  488.         if((level == 2))
  489.         {    level=1;
  490.             CopyID=0;
  491.         }
  492.         highlight_button_all(KeyID,CopyID);
  493.     }
  494.     #ifndef NEW_INPUT_MENU 
  495.     else if(input_flag==1)
  496.     {
  497.         pressnum_flag=0;
  498.         if(xoffset==7)
  499.         {
  500.             if(getstring[xoffset]!=32)
  501.             {
  502.             getstring[xoffset]=32;
  503.             osd_DrawRegionString(14+xoffset, 1, " ", COLOR_DBLUE,COLOR_LBLUE, FUNCTION_REGION); 
  504.             }
  505.             else
  506.             {
  507.             getstring[xoffset-1]=32;
  508.             osd_DrawRegionString(14+xoffset, 1, " ", COLOR_DBLUE,COLOR_GREEN, FUNCTION_REGION); 
  509.             xoffset--;
  510.             osd_DrawRegionString(14+xoffset, 1, " ", COLOR_DBLUE,COLOR_LBLUE, FUNCTION_REGION);
  511.             }
  512.             
  513.         }
  514.         else if((xoffset>0)&&(xoffset<7))
  515.         {
  516.             getstring[xoffset]=32;
  517.             getstring[xoffset-1]=32;
  518.             osd_DrawRegionString(14+xoffset, 1, " ", COLOR_DBLUE,COLOR_GREEN, FUNCTION_REGION); 
  519.             xoffset--;
  520.             osd_DrawRegionString(14+xoffset, 1, " ", COLOR_DBLUE,COLOR_LBLUE, FUNCTION_REGION);
  521.         }
  522.         else if(xoffset==0)
  523.         {   
  524.             getstring[xoffset]=32;
  525. //            getstring[xoffset-1]=32;
  526.             osd_DrawRegionString(14+xoffset, 1, " ", COLOR_DBLUE,COLOR_GREEN, FUNCTION_REGION);          
  527.            
  528.         }
  529.     }
  530.     #endif
  531. }
  532. /***************************************************************************
  533.  *  Function Name: switch_right                                            *
  534.  *  Purposes: shift highlight using the right key on the switch menu       *
  535.  *  Arguments: none                                                        *
  536.  *  Returns: none                                                          *
  537.  *  Update:  sunzhh 2004-11-10                                             *
  538.  **************************************************************************/
  539. void switch_right()
  540. {
  541.     if(InfoGui_flag==1)
  542.     {
  543.         invalid_key();
  544.     return;    
  545.     }
  546.     
  547.     if(input_flag==0)
  548.     {
  549.         if((level == 1)&&(KeyID == BUTTON_COPY))
  550.         {
  551.             level=2;
  552.             CopyID=1;
  553.         }
  554.         highlight_button_all(KeyID,CopyID);
  555.     }
  556.    #ifndef NEW_INPUT_MENU 
  557.     else if(input_flag==1)
  558.     {
  559.         if(xoffset<7)
  560.         {
  561.         getstring[xoffset]=32;//char " "
  562.             osd_DrawRegionString(14+xoffset, 1, " ", COLOR_DBLUE,COLOR_GREEN, FUNCTION_REGION); 
  563.             xoffset++;
  564.             osd_DrawRegionString(14+xoffset, 1, " ", COLOR_DBLUE,COLOR_LBLUE, FUNCTION_REGION);
  565.         }
  566.     }
  567.     #endif
  568. }
  569. /***************************************************************************
  570.  *  Function Name: switch_down                                             *
  571.  *  Purposes: shift highlight using the down key on the switch menu        *
  572.  *  Arguments: none                                                        *
  573.  *  Returns: none                                                          *
  574.  *  Update:  sunzhh 2004-11-10                                             *
  575.  **************************************************************************/
  576. void switch_down(void)
  577. {
  578.     if(InfoGui_flag==1)
  579.     {
  580.         invalid_key();
  581.     return;    
  582.     }
  583.     if(Switch_flag==1)
  584.     {
  585.        #ifdef CARD_SETUP_TYPE_4
  586.        if(SwitchID==BUTTON_UDISK)    
  587.            {
  588.                if(detect_type & SD_CARD_DEVICE)
  589.                    SwitchID=BUTTON_SD;
  590.                else if(detect_type & MS_CARD_DEVICE)
  591.                    SwitchID=BUTTON_MS;   
  592.             }    
  593.         else
  594.             SwitchID=BUTTON_UDISK ;
  595.         #elif defined(CARD_SETUP_TYPE_3)
  596.         if(detect_type&USB_DEVICE)
  597.         {
  598.             if(SwitchID==BUTTON_UDISK)
  599.             {
  600.                 if(detect_type & CF_CARD_DEVICE) 
  601.                     SwitchID=BUTTON_CF;
  602.                 else if(detect_type & SD_CARD_DEVICE)
  603.                     SwitchID=BUTTON_SD;         
  604.                 else if(detect_type & MS_CARD_DEVICE)
  605.                     SwitchID=BUTTON_MS;             
  606.                 else if(detect_type & SMC_CARD_DEVICE) 
  607.                     SwitchID=BUTTON_SMC;
  608.             }
  609.             else
  610.                 SwitchID=BUTTON_UDISK ;
  611.          }
  612.          else if((detect_type & CF_CARD_DEVICE)&&!(detect_type&USB_DEVICE))
  613.          {
  614.             if(SwitchID==BUTTON_CF)
  615.             {
  616.                 if(detect_type & SD_CARD_DEVICE)
  617.                     SwitchID=BUTTON_SD;         
  618.                 else if(detect_type & MS_CARD_DEVICE)
  619.                     SwitchID=BUTTON_MS;             
  620.                 else if(detect_type & SMC_CARD_DEVICE) 
  621.                     SwitchID=BUTTON_SMC;
  622.             }
  623.             else
  624.                 SwitchID=BUTTON_CF ;
  625.          }                                 
  626.         #endif              
  627.     highlight_button(SwitchID);    
  628.     }
  629.     else
  630.     {    
  631.     if(input_flag==0)
  632.     {
  633.     if(media_type==MEDIA_CD)
  634. {
  635.         if(level==1)
  636.         {
  637.      if(KeyID==BUTTON_COPY)
  638.              {
  639.          KeyID=BUTTON_CAPACITY;
  640.                  CopyID=0;
  641.              }
  642.      else if(KeyID==BUTTON_CD2P)
  643.          KeyID=BUTTON_COPY;
  644.      else if(KeyID==BUTTON_CAPACITY)
  645.          KeyID=BUTTON_CD2P;             
  646.         }
  647.         else if(level ==2)
  648.         {
  649.             if(CopyID>=COPY_NEWDIR)
  650.                 CopyID=COPY_ROOTDIR;
  651.             else
  652.                 CopyID++;
  653.         }
  654. }
  655. else 
  656.     if(media_type==MEDIA_CARD)
  657. {
  658. if(KeyID>=BUTTON_CAPACITY)
  659. {
  660. KeyID=BUTTON_P2CD;
  661. }
  662. else
  663. {
  664. KeyID++;
  665. }
  666. if(KeyID==BUTTON_COPY)
  667. {
  668. KeyID=BUTTON_DELETE;
  669. }
  670. }
  671.     highlight_button_all(KeyID,CopyID);
  672.     }
  673. }
  674. }
  675. /***************************************************************************
  676.  *  Function Name: switch_up                                             *
  677.  *  Purposes: shift highlight using the up key on the switch menu          *
  678.  *  Arguments: none                                                        *
  679.  *  Returns: none                                                          *
  680.  *  Update:  sunzhh 2004-11-10                                             *
  681.  **************************************************************************/
  682. void switch_up(void)
  683. {
  684.     if(InfoGui_flag==1)
  685.     {
  686.         invalid_key();
  687.     return;    
  688.     }    
  689.     
  690.     if(Switch_flag==1)
  691.     {
  692.         #ifdef CARD_SETUP_TYPE_4
  693.         if(SwitchID==BUTTON_UDISK)    
  694.             {
  695.                 if(detect_type & SD_CARD_DEVICE)
  696.                     SwitchID=BUTTON_SD;
  697.                 else if(detect_type & MS_CARD_DEVICE)
  698.                     SwitchID=BUTTON_MS;   
  699.              }    
  700.          else
  701.             SwitchID=BUTTON_UDISK ;
  702.         #elif defined(CARD_SETUP_TYPE_3)
  703.         if(detect_type&USB_DEVICE)
  704.         {
  705.             if(SwitchID==BUTTON_UDISK)
  706.             {
  707.                 if(detect_type & CF_CARD_DEVICE) 
  708.                     SwitchID=BUTTON_CF;
  709.                 else if(detect_type & SD_CARD_DEVICE)
  710.                     SwitchID=BUTTON_SD;         
  711.                 else if(detect_type & MS_CARD_DEVICE)
  712.                     SwitchID=BUTTON_MS;             
  713.                 else if(detect_type & SMC_CARD_DEVICE) 
  714.                     SwitchID=BUTTON_SMC;
  715.             }
  716.             else
  717.                 SwitchID=BUTTON_UDISK ;
  718.          }
  719.          else if((detect_type & CF_CARD_DEVICE)&&!(detect_type&USB_DEVICE))
  720.          {
  721.             if(SwitchID==BUTTON_CF)
  722.             {
  723.                 if(detect_type & SD_CARD_DEVICE)
  724.                     SwitchID=BUTTON_SD;         
  725.                 else if(detect_type & MS_CARD_DEVICE)
  726.                     SwitchID=BUTTON_MS;             
  727.                 else if(detect_type & SMC_CARD_DEVICE) 
  728.                     SwitchID=BUTTON_SMC;
  729.             }
  730.             else
  731.                 SwitchID=BUTTON_CF ;  
  732.         }                                
  733.          #endif     
  734.     highlight_button(SwitchID);    
  735.     }
  736.     else
  737.     {    
  738.     if(input_flag==0)
  739.     {
  740.     if(media_type==MEDIA_CD)
  741. {
  742.         if(level==1)
  743.         {
  744.      if(KeyID==BUTTON_COPY)
  745.      {
  746.      KeyID=BUTTON_CD2P;
  747.      }
  748.      else if(KeyID==BUTTON_CD2P)
  749.      {
  750.                 KeyID=BUTTON_CAPACITY;
  751.      }
  752.      else if(KeyID==BUTTON_CAPACITY)
  753.      {
  754.                 KeyID=BUTTON_COPY;
  755.      }
  756.         }
  757.         else if(level ==2)
  758.         {
  759.             if(CopyID<=COPY_ROOTDIR)
  760.                 CopyID=COPY_NEWDIR;
  761.             else
  762.                 CopyID--;
  763.         }
  764. }
  765. else 
  766.     if(media_type==MEDIA_CARD)
  767. {
  768. if(KeyID<=BUTTON_P2CD)
  769. {
  770. KeyID=BUTTON_CAPACITY;
  771. }
  772. else
  773. {
  774. KeyID--;
  775. }
  776. if(KeyID==BUTTON_COPY)
  777. {
  778. KeyID=BUTTON_P2CD;
  779. }
  780. }
  781.     highlight_button_all(KeyID,CopyID);
  782.     }
  783. }
  784. }
  785. /***************************************************************************
  786.  *  Function Name: Message_Show                                            *
  787.  *  Purposes:      show the message when the function is selected          *
  788.  *                  or fineshed                                            *
  789.  *  Arguments:     strID                                                    *
  790.  *  Returns:       none                                                    *
  791.  *  Update:        sunzhh 2004-11-10                                       *
  792.  **************************************************************************/
  793. void Message_Show(BYTE strID)
  794. {
  795. #ifdef FAT_Write_UI
  796. BYTE *str[]={"UDISK ERROR","COPY FILE OK","DELETE FILE OK","UDISK FORMATED","RENAMING FILE","PLEASE WAIT ...","UDISK FULL","UDISK EMPTY","PLEASE INPUT","NO MATCHED DIR","DIR EXISTING","UDISK PROTECT","UDISK PLUG OUT","ALREADY EXISTS"};
  797.     if(storage_type==USB_DEVICE)
  798.     {      
  799.         str[0]="UDISK ERROR";
  800.         str[3]="UDISK FORMATED";       
  801.         str[6]="UDISK FULL";
  802.         str[7]="UDISK EMPTY";
  803.         str[11]="UDISK PROTECT";
  804.         str[12]="UDISK PLUG OUT";       
  805.     }
  806.     else if(storage_type==CF_CARD_DEVICE)      
  807.     {
  808.         str[0]="CF CARD ERROR";
  809.         str[3]="CF CARD FORMATED";
  810.         str[6]="CF CARD FULL";
  811.         str[7]="CF CARD EMPTY";
  812.         str[11]="CF CARD PROTECT";
  813.         str[12]="CF CARD PLUG OUT";            
  814.     }
  815.     else if(storage_type==SD_CARD_DEVICE)
  816.     {      
  817.         str[0]="SD CARD ERROR";
  818.         str[3]="SD CARD FORMATED";
  819.         str[6]="SD CARD FULL";
  820.         str[7]="SD CARD EMPTY";
  821.         str[11]="SD CARD PROTECT";
  822.         str[12]="SD CARD PLUG OUT";            
  823.     }
  824.     else if(storage_type==MS_CARD_DEVICE) 
  825.     {     
  826.         str[0]="MS CARD ERROR";
  827.         str[3]="MS CARD FORMATED";
  828.         str[6]="MS CARD FULL";
  829.         str[7]="MS CARD EMPTY";
  830.         str[11]="MS CARD PROTECT";
  831.         str[12]="MS CARD PLUG OUT";            
  832.     }
  833.     else if(storage_type==SMC_CARD_DEVICE)
  834.     {      
  835.         str[0]="SMC CARD ERROR";
  836.         str[3]="SMC CARD FORMATED";
  837.         str[6]="SMC CARD FULL";
  838.         str[7]="SMC CARD EMPTY";
  839.         str[11]="SMC CARD PROTECT";
  840.         str[12]="SMC CARD PLUG OUT";        
  841.     }                                           
  842. #elif defined(CF_CARD_WRITE)
  843. BYTE *str[]={"CARD ERROR","COPY FILE OK","DELETE FILE OK","CARD FORMATED","RENAMING FILE","FILE COPYING","CARD FULL","CARD EMPTY","PLEASE INPUT","NO MATCH DIR","DIR EXISTING"};//add 2003-12-22
  844. #endif
  845.     osd_init_periphGUI();
  846. osd_DrawRegionString(6, 1, str[strID], COLOR_DBLUE, COLOR_LBLUE, MESSAGE_REGION); //draw the error
  847. delay_1ms(2000);
  848. }
  849. #ifdef NEW_INPUT_MENU
  850. int Str_Index_x,Str_Index_y;
  851. BYTE Exit_Enter_flag;
  852. BYTE Max_input_flag;
  853. BYTE Max_left_flag;
  854. int  input_xoffset;
  855. char *StrExit="EXIT";
  856. char *StrEnter="ENTER";
  857. char *Str_temp;
  858. char GetString[8]={};
  859. UINT8 Item_Num[5][8]={ 
  860.                     {0,1,2,3,4,5,6,7},
  861.                     {8,9,10,11,12,13,14,15},
  862.                     {16,17,18,19,20,21,22,23},
  863.                     {24,25,26,27,28,29,30,31},
  864.                     {32,33,34,35,36,37,38,39}
  865.                     };
  866. char *Item_Str[]={   "A","B","C","D","E","F","G","H","I","J",
  867.                      "K","L","M","N","O","P","Q","R","S","T",
  868.                      "U","V","W","X","Y","Z","1","2","3","4",
  869.                      "5","6","7","8","9","0","~","_","-","\"
  870.                      };                    
  871. void input_str_func_up(void)
  872. {  
  873.     input_str_clear_HL();
  874.     Str_Index_x--;
  875.     if(Str_Index_x<-1)
  876.     {
  877.         Str_Index_x=-1;        
  878.     }
  879.     else if(Str_Index_x==-1)
  880.     {
  881.         
  882.     }   
  883.     else if(Str_Index_x>-1)
  884.     {
  885.         input_HL_ItemStr(Item_Num[Str_Index_x][Str_Index_y]);
  886.     }
  887. }
  888. void input_str_func_down(void)
  889. {   
  890.      input_str_clear_HL();
  891.      Str_Index_x++;
  892.      if((Str_Index_x==5)&&(Str_Index_y<4))
  893.      {
  894.         Exit_Enter_flag=1;
  895.         osd_DrawRegionString(8, 7*8+5, StrExit, COLOR_WHITE, COLOR_DBLUE, FUNCTION_REGION);
  896.      }
  897.      else if((Str_Index_x==5)&&(Str_Index_y>=4))
  898.      {
  899.         Exit_Enter_flag=2;
  900.         osd_DrawRegionString(20, 7*8+5, StrEnter, COLOR_WHITE, COLOR_DBLUE, FUNCTION_REGION);
  901.      }
  902.      else if(Str_Index_x>5)
  903.      {     
  904.         Str_Index_x=5;
  905.         if(Exit_Enter_flag==1) 
  906.         {
  907.             osd_DrawRegionString(8, 7*8+5, StrExit, COLOR_WHITE, COLOR_DBLUE, FUNCTION_REGION);
  908.         }
  909.         else if(Exit_Enter_flag==2) 
  910.         {
  911.             osd_DrawRegionString(20, 7*8+5, StrEnter, COLOR_WHITE, COLOR_DBLUE, FUNCTION_REGION);
  912.         }
  913.         
  914.      }
  915.      else if(Str_Index_x<5)
  916.      {      
  917.          input_HL_ItemStr(Item_Num[Str_Index_x][Str_Index_y]);
  918.      }
  919. }
  920. void input_str_func_left(void)
  921. {        
  922.      if(Str_Index_x==-1)
  923.      {        
  924.         Max_input_flag=0;
  925.         input_xoffset--;
  926.         printf("=============input_xoffset:%d=================n",input_xoffset);
  927.         if(input_xoffset<0)
  928.           { 
  929.              Max_left_flag=1;
  930.              input_xoffset=0;
  931.           }
  932.         else if(Max_left_flag!=1)
  933.           {           
  934.              GetString[input_xoffset]=' ';
  935.              printf("===GetString:%s========n",GetString); 
  936.              osd_DrawRegionString(14+input_xoffset, 1, " ", COLOR_DBLUE,COLOR_GREEN, FUNCTION_REGION); 
  937.           }   
  938.         return;
  939.      }
  940.      input_str_clear_HL();  
  941.      if((Str_Index_x==5)&&(Exit_Enter_flag==2))
  942.      {
  943.          Exit_Enter_flag=1;
  944.          osd_DrawRegionString(8, 7*8+5, StrExit, COLOR_WHITE, COLOR_DBLUE, FUNCTION_REGION);
  945.      }  
  946.      else if((Str_Index_x==5)&&(Exit_Enter_flag==1))
  947.      {       
  948.          osd_DrawRegionString(8, 7*8+5, StrExit, COLOR_WHITE, COLOR_DBLUE, FUNCTION_REGION);
  949.      }  
  950.      else if(Str_Index_x<5)
  951.      {     
  952.          Str_Index_y--;
  953.          if(Str_Index_y<0) Str_Index_y=0;
  954.          input_HL_ItemStr(Item_Num[Str_Index_x][Str_Index_y]);
  955.      }
  956. }
  957. void input_str_func_right(void)
  958. {     
  959.      if(Str_Index_x==-1)
  960.      {   
  961.         if(input_xoffset>7)
  962.         {
  963.             Max_input_flag=1;
  964.             input_xoffset=7;
  965.         }
  966.         else if((input_xoffset<=7)&&(Max_input_flag!=1))
  967.         {
  968.              GetString[input_xoffset]=' ';
  969.              printf("===GetString:%s========n",GetString); 
  970.              osd_DrawRegionString(14+input_xoffset, 1, " ", COLOR_DBLUE,COLOR_GREEN, FUNCTION_REGION); 
  971.         }
  972.         input_xoffset++;
  973.         return;
  974.      }    
  975.      input_str_clear_HL();  
  976.       if((Str_Index_x==5)&&(Exit_Enter_flag==1))
  977.      {
  978.          Exit_Enter_flag=2;
  979.          osd_DrawRegionString(20, 7*8+5, StrEnter, COLOR_WHITE, COLOR_DBLUE, FUNCTION_REGION);
  980.      }     
  981.      else  if((Str_Index_x==5)&&(Exit_Enter_flag==2))
  982.      {      
  983.          osd_DrawRegionString(20, 7*8+5, StrEnter, COLOR_WHITE, COLOR_DBLUE, FUNCTION_REGION);
  984.      }     
  985.      else if(Str_Index_x<5)
  986.      {     
  987.          Str_Index_y++;
  988.          if(Str_Index_y>7) Str_Index_y=7;
  989.          input_HL_ItemStr(Item_Num[Str_Index_x][Str_Index_y]);
  990.      }
  991. }
  992. void input_str_func_select(void)
  993. {
  994.     BYTE Str_ID=0;     
  995.     Max_left_flag=0;
  996.     if((Str_Index_x==5)&&(Exit_Enter_flag==1))
  997.     {
  998.         input_str_func_exit();
  999.         return;
  1000.     } 
  1001.     if((Str_Index_x==5)&&(Exit_Enter_flag==2))
  1002.     {
  1003.         input_str_func_enter();
  1004.         return;
  1005.     }   
  1006.     Str_ID=Item_Num[Str_Index_x][Str_Index_y];
  1007.     if(input_xoffset>7)
  1008.     {
  1009.         Max_input_flag=1;
  1010.         input_xoffset=7;
  1011.     }
  1012.     else if((input_xoffset<=7)&&(Max_input_flag!=1))
  1013.     {
  1014.         Str_temp=Item_Str[Str_ID];
  1015.         GetString[input_xoffset]=*Str_temp;
  1016.         osd_DrawRegionString(14+input_xoffset, 1, Item_Str[Str_ID], COLOR_DBLUE,COLOR_LBLUE, FUNCTION_REGION);
  1017.     }
  1018.     input_xoffset++;
  1019. }
  1020.         
  1021. void input_str_func_exit(void)
  1022. {
  1023.      input_str_clear_variable();
  1024.      full_scrn &= (~PERIPHERAL);//for release the IR
  1025.  osd_init();    
  1026.      
  1027. }
  1028. void input_str_func_enter(void)
  1029. {
  1030.       if(KeyID == BUTTON_COPY)
  1031.         {   
  1032.             switch(CopyID)
  1033.             {
  1034.                 case COPY_EXISTING://copy to existing dir
  1035.                  card_copy(COPY_EXISTING);
  1036.          break;    
  1037.                 case COPY_NEWDIR://copy to created new folder
  1038.     card_copy(COPY_NEWDIR);
  1039.          break;                
  1040.             }
  1041.         }
  1042.         else if(KeyID == BUTTON_RENAME)//rename the selected file
  1043.         {
  1044.              rename_cardfile();        
  1045.         }
  1046.       
  1047. }
  1048. void input_str_clear_variable(void)
  1049. {
  1050.     int i;
  1051.     for(i=0;i<8;i++)
  1052.        GetString[i]=' ';
  1053.     Str_Index_x=0;
  1054.     Str_Index_y=0;
  1055.     Exit_Enter_flag=0;
  1056.     Max_input_flag=0;
  1057.     Max_left_flag=0;
  1058.     input_xoffset=0;    
  1059. }
  1060. #endif
  1061. /***************************************************************************
  1062.  *  Function Name: input_page                                              *
  1063.  *  Purposes:  draw the input page after select                            * 
  1064.  *             "copy to new dir/existing dir"                              *
  1065.  *  Arguments: none                                                        *
  1066.  *  Returns:   none                                                        *
  1067.  *  Update:    sunzhh 2004-11-10                                           *
  1068.  **************************************************************************/
  1069. void input_page(void)
  1070. {
  1071.     #ifdef NEW_INPUT_MENU   
  1072.     BYTE *title_str1="INPUT DIR:";
  1073.     BYTE *title_str2="INPUT NAME:";
  1074.     osd_init_periphGUI();
  1075.     osd_draw_region_rect(0, 0, 64*8, 40, COLOR_GREEN, 3);
  1076.     osd_draw_region_rect(0, 278, 64*8, 10, COLOR_GREEN, 3);
  1077.     if(KeyID == BUTTON_COPY)
  1078.     osd_DrawRegionString(2, 1, title_str1, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION);
  1079.     else if(KeyID == BUTTON_RENAME)
  1080.     osd_DrawRegionString(2, 1, title_str2, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION);
  1081.     osd_DrawRegionString(14+xoffset, 1, " ", COLOR_DBLUE,COLOR_LBLUE, FUNCTION_REGION);
  1082. SetOsdCol(FUNCTION_REGION, FUNCTION_REGION, 0,__palette4F(192,192, 192, 0xe0)); //draw background of the region
  1083.     //init variable
  1084.     input_str_clear_variable();
  1085.     input_str_clear_HL();
  1086.     //HL first itemstr
  1087.     input_HL_ItemStr(0);
  1088.     //for IR U/D/L/R/Sel input str func setting
  1089.     SetFullscrnCmdFuncPtr(input_str_func_up, input_str_func_down, input_str_func_left,
  1090.                                   input_str_func_right, input_str_func_select);
  1091.     #else  
  1092.     int i;
  1093.     BYTE *str[]={   "      INSTRUCTION       ",
  1094.                     "1->1 A B C    2->2 D E F",
  1095.                     "3->3 G H I    4->4 J K L",
  1096.                     "5->5 M N O    6->6 P Q R",
  1097.                     "7->7 S T U    8->8 V W X",
  1098.                     "9->9 Y Z ~    0->0 _ - \",
  1099.                     "<: CANCEL     >: SPACE"};
  1100.     BYTE *title_str1="INPUT DIR:";
  1101.     BYTE *title_str2="INPUT NAME:";
  1102.     input_flag=1;
  1103.     osd_init_periphGUI();
  1104.     osd_draw_region_rect(0, 0, 64*8, 40, COLOR_GREEN, 3);
  1105.     osd_draw_region_rect(0, 278, 64*8, 10, COLOR_GREEN, 3);
  1106.     if(KeyID == BUTTON_COPY)
  1107.     osd_DrawRegionString(2, 1, title_str1, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION);
  1108.     else if(KeyID == BUTTON_RENAME)
  1109.     osd_DrawRegionString(2, 1, title_str2, COLOR_YELLOW, COLOR_GREEN, FUNCTION_REGION);
  1110.     osd_DrawRegionString(14+xoffset, 1, " ", COLOR_DBLUE,COLOR_LBLUE, FUNCTION_REGION);
  1111. SetOsdCol(FUNCTION_REGION, FUNCTION_REGION, 0,__palette4F(192,192, 192, 0xe0)); //draw background of the region
  1112.     for(i=0;i<=6;i++)
  1113.     osd_DrawRegionString(4, (i+1)*8+5, str[i], COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION);
  1114.     #endif
  1115. }
  1116. #ifdef NEW_INPUT_MENU
  1117. void input_str_clear_HL(void)
  1118. {
  1119.     int i;
  1120.     BYTE *str[]={   " A  B  C  D  E  F  G  H ",
  1121.                     " I  J  K  L  M  N  O  P ",
  1122.                     " Q  R  S  T  U  V  W  X ",
  1123.                     " Y  Z  1  2  3  4  5  6 ",
  1124.                     " 7  8  9  0  ~  _  -  \",
  1125.                     "                        ",                    
  1126.                     "    EXIT        ENTER   "};
  1127.    for(i=0;i<=6;i++)
  1128.    osd_DrawRegionString(4, (i+1)*8+5, str[i], COLOR_WHITE, COLOR_GRAYWHITE, FUNCTION_REGION);                     
  1129. }            
  1130. void input_HL_ItemStr(BYTE itemstr_index )
  1131. {
  1132.     BYTE itemstr_xstart = 0;
  1133.     BYTE itemstr_ystart = 0;
  1134.     BYTE x,y;   
  1135.     x=itemstr_index%8;
  1136.     y=itemstr_index/8;
  1137.     itemstr_xstart =5 + x*3;
  1138.     itemstr_ystart =13+ y*8;
  1139.     osd_DrawRegionString(itemstr_xstart, itemstr_ystart,Item_Str[itemstr_index], COLOR_WHITE, COLOR_DBLUE,FUNCTION_REGION);      
  1140.     
  1141. }
  1142. #endif
  1143. /***************************************************************************
  1144.  *  Function Name: input_name                                              *
  1145.  *  Purposes:  show the input letter on the input page                     * 
  1146.  *  Arguments: none                                                        *
  1147.  *  Returns:   none                                                        *
  1148.  *  Update:    sunzhh 2004-11-10                                           *
  1149.  **************************************************************************/
  1150. void input_name(int num)
  1151. {
  1152.     BYTE *namestring[10][4]={ 
  1153.                             {"0","_","-","\"},
  1154.                             {"1","A","B","C"},
  1155.                             {"2","D","E","F"},
  1156.                             {"3","G","H","I"},
  1157.                             {"4","J","K","L"},
  1158.                             {"5","M","N","O"},
  1159.                             {"6","P","Q","R"},
  1160.                             {"7","S","T","U"},
  1161.                             {"8","V","W","X"},
  1162.                             {"9","Y","Z","~"}};
  1163.     if(pressnum_flag!=1)
  1164.     {        
  1165.                
  1166.     if(pressnum!=num)
  1167.     {
  1168.         PressID=0;
  1169.         pressnum=num;
  1170.     }
  1171.     else
  1172.     {
  1173.         if(PressID>=3)
  1174.             PressID=0;  
  1175.         else
  1176.             PressID++;  
  1177.     }   
  1178.     osd_DrawRegionString(14+xoffset, 1, namestring[num][PressID], COLOR_DBLUE,COLOR_LBLUE, FUNCTION_REGION);
  1179.     temp=namestring[num][PressID];
  1180.     //printf("temp=%cn",*temp);
  1181. }
  1182. }
  1183. /***************************************************************************
  1184.  *  Function Name: polling_input_name                                      *
  1185.  *  Purposes:  called by polling_100ms in polling.c to                     * 
  1186.  *             refresh the letter inputted                                 *
  1187.  *  Arguments: none                                                        *
  1188.  *  Returns:   none                                                        *
  1189.  *  Update:    wangw 2004-11-10                                            * 
  1190.  **************************************************************************/
  1191. void polling_input_name(void)
  1192. {
  1193.     static BYTE i=0;
  1194.     static BYTE temp1=50,temp2=50;
  1195.     if((i==0)&&(pressnum!=10))
  1196.     {
  1197.         temp1=pressnum;
  1198.         temp2=PressID;
  1199.         i++;
  1200.     }
  1201.     else
  1202.     {
  1203.         if((pressnum!=temp1)||(PressID!=temp2))
  1204.         {
  1205.             i=0;   
  1206.         }
  1207.         else
  1208.         {
  1209.             if((i==10))
  1210.             {   
  1211.                 if((pressnum==temp1)&&(PressID==temp2))
  1212.                 {
  1213.                         getstring[xoffset]=*temp;
  1214.                         osd_DrawRegionString(14+xoffset, 1, temp, COLOR_DBLUE,COLOR_GREEN, FUNCTION_REGION); 
  1215.                         xoffset++;
  1216.                         if(xoffset>7)
  1217.                         {
  1218.                              pressnum_flag=1;    
  1219.                              xoffset=7;
  1220.                         }
  1221.                        
  1222.                         osd_DrawRegionString(14+xoffset, 1, " ", COLOR_DBLUE,COLOR_LBLUE , FUNCTION_REGION);
  1223.                 }
  1224.                 i=0;
  1225.                 pressnum=10;
  1226.             }
  1227.             else
  1228.                 i++;
  1229.         }
  1230.     }
  1231. }
  1232. /***************************************************************************
  1233.  *  Function Name: card_copy                                               *
  1234.  *  Purposes:  the entry of coping file from                               * 
  1235.  *             cdrom to card/USB and showing related GUI                   *
  1236.  *  Arguments: copy_mode                                                        *
  1237.  *  Returns:   none                                                        *
  1238.  *  Update:    wangw 2004-11-10                                            * 
  1239.  **************************************************************************/
  1240. void card_copy(BYTE copy_mode)
  1241. {
  1242.     #ifdef SPHE8202_ALL_TYPE_CARD_WRITE
  1243.     card_browse_sign = 0;
  1244.     CardTestReady();
  1245.     play_state=VCD_STATE_NORMAL;
  1246.     card_browse_sign = 1;
  1247.     #endif
  1248. int copy_status;
  1249. #ifdef CF_CARD_WRITE
  1250. // if(CardIdentify()!=0)//very important!!!
  1251. if(FSIdentify()!=0)//very important!!!
  1252. #else
  1253.     if(!CARDIsPlugIn())
  1254. #endif
  1255. {
  1256.     
  1257. Message_Show(ERROR_MESSAGE);
  1258. show_switch(Select_Media);
  1259. }
  1260. else
  1261. {
  1262. if(pFsJpeg->gifsFuncBtn == FS_FUNC_MP3)
  1263. {
  1264. sign_PFun=PFUN_WRITE;//write cf card
  1265. AVD_SetMediaInterrupt();//stop the current mp3, Can't be used for JPEG!!
  1266. Message_Show(PFUN_COPYING);
  1267. }
  1268. else if(pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)
  1269. {
  1270. sign_PFun=PFUN_WRITE;//write JPEG
  1271. Message_Show(PFUN_COPYING);
  1272. // copy_status=CardSchedule(copy_mode);
  1273. copy_status=FSSchedule(copy_mode);
  1274. StorageWriteMessageShow(copy_status);
  1275. full_scrn &= (~PERIPHERAL);//for release the IR
  1276. osd_init();
  1277. #ifdef NEW_INPUT_GUI
  1278. input_str_clear_variable();
  1279. #endif
  1280. }
  1281. #ifdef FAT_Write_File_System  //added by wangwei,2004-11-5 15:42(for other media,eg:mp4,dat...)
  1282. else if(pFsJpeg->gifsFuncBtn == FS_FUNC_OTHER)
  1283.         {
  1284.             sign_PFun=PFUN_WRITE;//write JPEG
  1285. Message_Show(PFUN_COPYING);
  1286. // copy_status=CardSchedule(copy_mode);
  1287. copy_status=FSSchedule(copy_mode);
  1288. StorageWriteMessageShow(copy_status);
  1289. full_scrn &= (~PERIPHERAL);//for release the IR
  1290. osd_init();
  1291. #ifdef NEW_INPUT_GUI
  1292. input_str_clear_variable();
  1293. #endif
  1294.         }
  1295.         #endif  //FAT_Write_File_System
  1296. }
  1297. }
  1298. /********************************************************************************
  1299. **Function      : StorageWriteMessageShow()
  1300. **Description   : show message
  1301. **Return value  : null
  1302. **Creator       : lijd 2004-12-8 17:21
  1303. ********************************************************************************/
  1304. void StorageWriteMessageShow(int copy_status)
  1305. {
  1306.     switch(copy_status)
  1307.     {
  1308.         case -1:
  1309.                 Message_Show(P_SPACEFULL);
  1310.                 break;
  1311.         case -2:
  1312.                 Message_Show(P_NOMATCH);
  1313.                 break;
  1314.         case -3:
  1315.                 Message_Show(P_DIREXISTING);
  1316.                 break;
  1317.         case -4:
  1318.                 Message_Show(P_UDISK_PROTECT);
  1319.                 break; 
  1320.         case -5:
  1321.                 Message_Show(P_UDISK_PLUGOUT);
  1322.                 break;
  1323.         case -6:
  1324.                 Message_Show(P_DIT_EXIST);
  1325.                 break;
  1326.         case -7:
  1327.                 
  1328.                 break;
  1329.         default:
  1330.                 Message_Show(PFUN_WRITE);
  1331.                 break;                                               
  1332.     }
  1333.     
  1334. }
  1335. /***************************************************************************
  1336.  *  Function Name: cd2card                                                 *
  1337.  *  Purposes: the entry of changing playing cdrom to card/USB              *
  1338.  *  Arguments: none                                                        *
  1339.  *  Returns: none                                                          *
  1340.  **************************************************************************/
  1341. void cd2card(void)
  1342. {
  1343. read_card_sign=1; //fengjl 2004-07-06 11:03
  1344.     SwitchMedia(CD2CARD);
  1345. }
  1346. /***************************************************************************
  1347.  *  Function Name: card2cd                                                 *
  1348.  *  Purposes: the entry of changing playing card/USB to cdrom              *
  1349.  *  Arguments: none                                                        *
  1350.  *  Returns: none                                                          *
  1351.  **************************************************************************/
  1352. void card2cd(void)
  1353. {
  1354.     SwitchMedia(CARD2CD);
  1355. }
  1356. /***************************************************************************
  1357.  *  Function Name: card_delete                                             *
  1358.  *  Purposes: the entry of deleting the selected file                      *
  1359.  *  Arguments: none                                                        *
  1360.  *  Returns: none                                                          *
  1361.  **************************************************************************/
  1362. int card_delete(void)
  1363. {
  1364. #ifdef CF_CARD_WRITE
  1365. // if(CardIdentify()!=0)//very important!!!
  1366. if(FSIdentify()!=0)//very important!!!
  1367. #else
  1368.     if(!CARDIsPlugIn())
  1369. #endif
  1370. {
  1371. Message_Show(ERROR_MESSAGE);
  1372. show_switch(Select_Media);
  1373. }
  1374. else
  1375. {
  1376. sign_PFun=PFUN_DELETE;//delete data
  1377. // if(CardSchedule(0)==-1)
  1378. if(FSSchedule(0)==-1)
  1379. {
  1380. Message_Show(P_SPACEEMPTY);
  1381. //turn to CDROM
  1382. card2cd();
  1383. return -1;
  1384. }
  1385. else
  1386. {
  1387. Message_Show(PFUN_DELETE);
  1388. }
  1389. }
  1390. return 0;
  1391. }
  1392. /***************************************************************************
  1393.  *  Function Name: format_card                                             *
  1394.  *  Purposes: the entry of formating the selected storage                  *
  1395.  *  Arguments: none                                                        *
  1396.  *  Returns: none                                                          *
  1397.  **************************************************************************/
  1398. void format_card(void)
  1399. {
  1400. #ifdef CF_CARD_WRITE
  1401. // if(CardIdentify()!=0)//very important!!!
  1402. if(FSIdentify()!=0)//very important!!!
  1403. #else
  1404.     if(!CARDIsPlugIn())
  1405. #endif
  1406. {
  1407. Message_Show(ERROR_MESSAGE);
  1408. show_switch(Select_Media);
  1409. }
  1410. else
  1411. {
  1412. sign_PFun=PFUN_FORMAT;//format card
  1413. // CardSchedule(0);
  1414. FSSchedule(0);
  1415. Message_Show(PFUN_FORMAT);
  1416. }
  1417. }
  1418. /***************************************************************************
  1419.  *  Function Name: rename_cardfile                                         *
  1420.  *  Purposes: the entry of renaming the selected file                      *
  1421.  *  Arguments: none                                                        *
  1422.  *  Returns: none                                                          *
  1423.  **************************************************************************/
  1424. void rename_cardfile(void)
  1425. {
  1426. #ifdef CF_CARD_WRITE
  1427. // if(CardIdentify()!=0)//very important!!!
  1428. if(FSIdentify()!=0)//very important!!!
  1429. #else
  1430.     if(!CARDIsPlugIn())
  1431. #endif
  1432. {
  1433. Message_Show(ERROR_MESSAGE);
  1434. show_switch(Select_Media);
  1435. }
  1436. else
  1437. {
  1438. sign_PFun=PFUN_RENAME;//Create Dir
  1439. // CardSchedule(0);
  1440. FSSchedule(0);
  1441. Message_Show(PFUN_RENAME);
  1442. cd2card();//refresh the card
  1443. }
  1444. }
  1445. /***************************************************************************
  1446.  *  Function Name: switch_select                                           *
  1447.  *  Purposes: select the function button to finish the request of the user *
  1448.  *  Arguments: none                                                        *
  1449.  *  Returns: none                                                          *
  1450.  *  Update:  sunzhh 2004-11-10                                             *
  1451.  **************************************************************************/
  1452. void switch_select(void)
  1453. {
  1454.     BYTE i;
  1455.     if(InfoGui_flag==1)
  1456.     {
  1457.         invalid_key();
  1458.     return;    
  1459.     }    
  1460.     
  1461.     if(Switch_flag==1)
  1462.     {
  1463.         switch(SwitchID)
  1464.      {
  1465.      case BUTTON_UDISK:
  1466.                     Select_Media=Media_UDISK;
  1467.                     storage_type = USB_DEVICE;
  1468.          break;
  1469.             #ifdef CARD_SETUP_TYPE_3         
  1470.      case BUTTON_CF:
  1471.                     Select_Media=Media_CF;
  1472.                     storage_type = CF_CARD_DEVICE;
  1473.                 break;//if delete the last file, then convert to CD
  1474.             #endif                
  1475.      case BUTTON_SD:
  1476.                     Select_Media=Media_SD;
  1477.                     storage_type = SD_CARD_DEVICE;
  1478.      break;  
  1479.      case BUTTON_MS:
  1480.                     Select_Media=Media_MS;
  1481.                     storage_type = MS_CARD_DEVICE;
  1482.      break;
  1483.             #ifdef CARD_SETUP_TYPE_3                         
  1484.      case BUTTON_SMC:
  1485.                     Select_Media=Media_SMC;
  1486.                     storage_type = SMC_CARD_DEVICE;
  1487.      break;
  1488.             #endif
  1489.      }
  1490.         show_switch(Select_Media);
  1491.     }
  1492.     else
  1493.     {
  1494.     if(input_flag==0)
  1495.     {
  1496.      switch(KeyID)
  1497.      {
  1498.      case BUTTON_COPY:
  1499.                 if(CopyID==1)
  1500.                 {
  1501.                  card_copy(COPY_ROOTDIR);
  1502.      }
  1503.                 if((CopyID==2)||(CopyID==3))
  1504.                 {
  1505.                     input_page();
  1506.                 }
  1507.      break;
  1508.     
  1509.      case BUTTON_DELETE:
  1510.                 if(card_delete()==-1) 
  1511.                 break;//if delete the last file, then convert to CD
  1512.      case BUTTON_CD2P:
  1513.                 cd2card();
  1514.      break;
  1515.     
  1516.      case BUTTON_FORMAT:
  1517.                 format_card();
  1518.      case BUTTON_P2CD:
  1519.                 card2cd();
  1520.      break;
  1521.     
  1522.      case BUTTON_RENAME:
  1523.                 input_page();
  1524.      break;
  1525.     
  1526.      case BUTTON_CAPACITY:
  1527. //                    osd_init();
  1528. //                StorageGetCapacityInfo();
  1529.                 show_CapacityInfo();
  1530.                  break;    
  1531.      }
  1532. }
  1533.  #ifndef NEW_INPUT_MENU 
  1534.     else if(input_flag==1)
  1535.     {
  1536.         for(i=0;i<8;i++)
  1537.         {
  1538.             if(getstring[i]!=32)
  1539.                break;
  1540.             else if(i==7)
  1541.             {
  1542.                 Message_Show(P_INPUT);
  1543.                 xoffset=0;
  1544.                 input_page();
  1545.                 return;
  1546.             }
  1547.         }
  1548.         if(KeyID == BUTTON_COPY)
  1549.         {   
  1550.             switch(CopyID)
  1551.             {
  1552.                 case COPY_EXISTING://copy to existing dir
  1553.                  card_copy(COPY_EXISTING);
  1554.          break;    
  1555.                 case COPY_NEWDIR://copy to created new folder
  1556.     card_copy(COPY_NEWDIR);
  1557.          break;                
  1558.             }
  1559.         }
  1560.         else if(KeyID == BUTTON_RENAME)//rename the selected file
  1561.         {
  1562.              rename_cardfile();        
  1563.         }
  1564.     }
  1565.     #endif
  1566. }
  1567. }
  1568. /***************************************************************
  1569. **Function: FSSchedule()
  1570. **Description: Schedule for getting the different function.
  1571. **return value:   if -1, then no enough space for write
  1572. **Create: wuxiaofeng, 2003-9-15
  1573. **modified: add argument for three types of copy!
  1574. **lijd  updating   2004-12-6 16:19
  1575. ***************************************************************/
  1576. //int CardSchedule(BYTE copy_mode)
  1577. int FSSchedule(BYTE copy_mode)
  1578. {
  1579. #ifdef FAT_Write_File_System  //added by wangwei,2004-11-9 9:10
  1580. if(storage_type == USB_DEVICE)
  1581.     UsbTestReady();
  1582. #endif
  1583. UINT32 lba;
  1584. UINT32 assignlba;
  1585. int  iRes=0;//lijd  for udisk protect 2004-11-18 16:50
  1586. if (pFsJpeg->ControlArea == CNT_AREA_FILE)
  1587. {
  1588.     GetOriginalFileMainName(0); //lijd 2004-12-6 16:19
  1589. }
  1590. else  if(pFsJpeg->ControlArea == CNT_AREA_DIR)
  1591. {
  1592.     GetAllFileNameFromCopyDir();
  1593. }
  1594. // lba=CardGetRoot();//get the card information
  1595. lba=FSGetRoot();//get the card information
  1596. if(sign_PFun==PFUN_WRITE)
  1597. {
  1598. switch(copy_mode)
  1599. {
  1600. case COPY_ROOTDIR:
  1601. // iRes=CardWriteFDB(lba); 
  1602. iRes=FSStorageCopy(lba); 
  1603. switch(iRes)
  1604.                 {
  1605.                     case -1:
  1606.                             return -1;
  1607.                             break;
  1608.                     case -2:
  1609.                             return -4;
  1610.                             break;
  1611.                     case -3:
  1612.                             return -5;   
  1613.                             break;
  1614.                     case -4:
  1615.                             return -6;
  1616.                             break; 
  1617.                     case -5:
  1618.                             return -7;
  1619.                             break;   
  1620.                     default:                
  1621.                             break;                                               
  1622.                 }
  1623. break;
  1624. case COPY_EXSITING:
  1625. // assignlba=CardSearchDir(lba, getstring);
  1626. #ifdef NEW_INPUT_MENU
  1627.                 assignlba=FSSearchDir(lba, GetString);
  1628.                 #else
  1629. assignlba=FSSearchDir(lba, getstring);
  1630. #endif
  1631. if(assignlba==0)//have no matched dir
  1632. {
  1633. sign_PFun=PFUN_DEFAULT;//clear
  1634. return -2;
  1635. }
  1636. // iRes=CardWriteFDB(assignlba);
  1637. iRes=FSStorageCopy(assignlba);
  1638. switch(iRes)
  1639.                 {
  1640.                     case -1:
  1641.                             return -1;
  1642.                             break;
  1643.                     case -2:
  1644.                             return -4;
  1645.                             break;
  1646.                     case -3:
  1647.                             return -5;   
  1648.                             break;
  1649.                     case -4:
  1650.                             return -6;
  1651.                             break; 
  1652.                     case -5:
  1653.                             return -7;
  1654.                             break;   
  1655.                     default:                
  1656.                             break;                                               
  1657.                 }
  1658. break;
  1659. case COPY_NEWDIR://only in root
  1660. // assignlba=CardCreateDir(getstring);
  1661. #ifdef NEW_INPUT_MENU
  1662.                 assignlba=FSCreateDir(lba,GetString);
  1663.                 #else
  1664. assignlba=FSCreateDir(lba,getstring);
  1665. #endif
  1666. if(assignlba==-1)//have same name with the existing dir
  1667. {
  1668. sign_PFun=PFUN_DEFAULT;//clear
  1669. return -3;//add 2003-12-22
  1670. }
  1671. // iRes=CardWriteFDB(assignlba); 
  1672. iRes=FSStorageCopy(assignlba); 
  1673. switch(iRes)
  1674.                 {
  1675.                     case -1:
  1676.                             return -1;
  1677.                             break;
  1678.                     case -2:
  1679.                             return -4;
  1680.                             break;
  1681.                     case -3:
  1682.                             return -5;   
  1683.                             break;
  1684.                     case -4:
  1685.                             return -6;
  1686.                             break; 
  1687.                     case -5:
  1688.                             return -7;
  1689.                             break;   
  1690.                     default:                
  1691.                             break;                                               
  1692.                 }
  1693. break;
  1694. }
  1695. }
  1696. else if(sign_PFun==PFUN_DELETE)
  1697. {
  1698. // if(CardDeleteData()==-1)
  1699. if(FSDeleteData()==-1)
  1700. {
  1701. sign_PFun=PFUN_DEFAULT;//clear
  1702. return -1;
  1703. }
  1704. }
  1705. else if(sign_PFun==PFUN_FORMAT)
  1706. {
  1707. // CardFormat();
  1708. FSFormat();
  1709. }
  1710. else if(sign_PFun==PFUN_RENAME)
  1711. {
  1712. // CardRenameFile(getstring);//change to rename file 10-30
  1713. #ifdef NEW_INPUT_MENU
  1714.         FSRenameFile(GetString);
  1715.         #else
  1716. FSRenameFile(getstring);//change to rename file 10-30
  1717. #endif
  1718. }
  1719. sign_PFun=PFUN_DEFAULT;//clear
  1720. return 0;
  1721. }
  1722. #endif//defined(SPHE8202_USB_Write)||defined(CF_CARD_WRITE)