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

DVD

开发平台:

C/C++

  1.  * 2004-06-08
  2.  */
  3. void FSGUI_UpdateInfoArea(BYTE* strInfo)
  4. {
  5. #ifdef AUDIO_SHOW_SAVER
  6.     if (bDisableGUI) return;
  7. #endif
  8.     //update the background,
  9.     //note:avoid redraw the rotating icon and the left and right sides
  10.     //the width of the icon and left side totally are about 45
  11. #define INFO_STR_XSTART 45
  12. FSGUI_DrawBackGround(fsArea[FS_AREA_PATHBACKGROUND].xStart + INFO_STR_XSTART,
  13. fsArea[FS_AREA_PATHBACKGROUND].yStart,
  14. fsArea[FS_AREA_PATHBACKGROUND].xSize - INFO_STR_XSTART,
  15. fsArea[FS_AREA_PATHBACKGROUND].ySize,
  16. LAY_PLAYING_BAR_3_2);
  17.     //show the dir and file playing string
  18. FSGUI_ShowString(fsArea[FS_AREA_PATHINFO].xStart,
  19. fsArea[FS_AREA_PATHINFO].yStart, strInfo,
  20. FS_FONTCOLOR_PATH_Y,
  21. FS_FONTCOLOR_PATH_CrCb);
  22. }
  23. #endif //#if !defined (FS_BMP_GUI)
  24. void FSGUI_Shuffle()
  25. {
  26. // generate a random directory, panxing, 2002-1-22
  27. // use one while loop to avoid no specify style file in the random directory, panxing, 2002-1-22
  28. do
  29. {
  30. pFsJpeg->fsnav_dir_will = regs0->stc_15_0 % pFsJpeg->fsnav_dir_cnt;
  31. } while (FSGUI_PreChangeDir(&(pFsJpeg->fsnav_dir_will), 0));
  32. pFsJpeg->fsnav_dir_now = pFsJpeg->fsnav_dir_will;
  33. // generate a random file page, panxing, 2002-1-22
  34. pFsJpeg->file_page_will = regs0->stc_15_0 % pFsJpeg->File_Page_Count;
  35. PrepareForChangeFilePage(pFsJpeg->file_page_will, pFsJpeg->file_page_will * PER_PAGE, 2);
  36. // generate a random file_curent pointer, panxing, 2002-1-22
  37. pFsJpeg->file_will = regs0->stc_15_0 % pFsJpeg->File_Count;
  38. pFsJpeg->fsnav_trk_will = pFsJpeg->file_array[pFsJpeg->file_will] - pFsJpeg->first_mp3_entry;
  39. Will2Playing();
  40. refresh_file_page = 1;
  41. refresh_dir_page = 1;
  42. refresh_dir_icon = 1;
  43. }
  44. void FSGUI_JpgUpdateOSD(void)
  45. {
  46. #ifdef MP3_DIRECT_SELECT  //fengjl  edit to update VFD //axel 2003-12-26 14:36 update jpg info on VFD
  47. disp_trk_now = pFsJpeg->first_mp3_seq + pFsJpeg->file_page_now * PER_PAGE + pFsJpeg->file_current + 1;
  48. #else
  49. disp_trk_now = pFsJpeg->file_page_now * PER_PAGE + pFsJpeg->file_current + 1;
  50. #endif
  51.     if(t_disp)
  52.     {
  53.         DispCookOSD0(1);
  54.         DispPolling(0);
  55.     }
  56. }
  57. int FSChkProg(BYTE iPage, BYTE iItem)
  58. {
  59. int iRes=0;
  60. int iFileCount;
  61. // iPage is not page but directory, panxing, 2002-1-29
  62. if(iPage > pFsJpeg->count_dir[pFsJpeg->gifsFuncBtn - FS_FUNC_MP3])
  63. {
  64. return 0;
  65. }
  66. iFileCount = CountSpecifyFile(AnchorDir(iPage-1));
  67. if(iFileCount == 0)
  68. {
  69. iRes = 0;
  70. }
  71. else
  72. {
  73. if (iItem <= iFileCount)
  74. {
  75. iRes = 1;
  76. }
  77. }
  78.     return iRes;
  79. }
  80. int  FSGUI_GetDispTrack()
  81. {
  82. int iRes;
  83. #ifdef MP3_DIRECT_SELECT
  84. iRes = pFsJpeg->first_mp3_seq + pFsJpeg->file_page_now * PER_PAGE + pFsJpeg->file_current + 1;
  85. #else
  86. iRes = pFsJpeg->file_page_now * PER_PAGE + pFsJpeg->file_current + 1;
  87. #endif
  88. return iRes;
  89. }
  90. void FSGUI_2Last()
  91. {
  92.     refresh_dir_icon = 1;
  93.     pFsJpeg->fsnav_dir_now = AnchorDir(pFsJpeg->count_dir[pFsJpeg->gifsFuncBtn - FS_FUNC_MP3] - 1);
  94.     pFsJpeg->dir_current = pFsJpeg->count_dir[pFsJpeg->gifsFuncBtn - FS_FUNC_MP3] % PER_PAGE;
  95.     FSGUI_PreChangeDir(&(pFsJpeg->fsnav_dir_now), 0);
  96.     FSGUI_FileSelect(pFsJpeg->file_specify_in_dir);
  97.     pFsJpeg->fsnav_dir_will = pFsJpeg->fsnav_dir_now; //Jeff 20020524
  98. }
  99. void FSGUI_Refresh(void)
  100. {
  101. #if 0
  102. printf("=============Info of mp3 navigation============n");
  103. printf("file_current=%3d, file_page_now  =%3d, fsnav_trk_now =%3dn", pFsJpeg->file_current, pFsJpeg->file_page_now, pFsJpeg->fsnav_trk_now);
  104. printf("file_will   =%3d, file_page_will =%3d, fsnav_trk_will=%3dn",pFsJpeg->file_will, pFsJpeg->file_page_will, pFsJpeg->fsnav_trk_will);
  105. printf("File_Count  =%3d, File_Page_Count=%3d, file_specify_in_dir=%3dn", pFsJpeg->File_Count, pFsJpeg->File_Page_Count, file_specify_in_dir);
  106. printf("dir_current =%3d, fsnav_dir_now  =%3dn", pFsJpeg->dir_current, pFsJpeg->fsnav_dir_now);
  107. printf("dir_page_now=%3d, fsnav_dir_will =%3dn", pFsJpeg->dir_page_now, pFsJpeg->fsnav_dir_will);
  108. printf("refresh_dir_icon=%d,refresh_file_page=%d,refresh_dir_page=%dn",refresh_dir_icon,
  109. refresh_file_page,refresh_dir_page);
  110. #endif
  111. #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  112.     FSGUI_RotateDiscIcon(0);//solve the problem when enter"return",the disc icon disappeared.zhaoyanhua 3-7-10 15:36
  113. #endif
  114. #ifdef FS_BMP_GUI//for display playing or HL Dir
  115. DirList();
  116. FSShowDirIcon();
  117. #else
  118. DrawButton();
  119. FSShowDirIcon();
  120. //refresh_dir_page=1;
  121. DirList();
  122. #endif
  123. ShowFileIcon();
  124. //refresh_file_page=1;
  125. FileList();
  126. SelectHL();
  127. #ifdef FSGUI_NO_BLINK_SCROLL
  128. if(up_down_done && (pFsJpeg->ControlArea == CNT_AREA_FILE))
  129.     up_down_done=0;
  130. else
  131.     MoveScroll(pFsJpeg->file_page_will * PER_PAGE + pFsJpeg->file_will,SCROLLBAR_REFRESH);
  132. #elif defined (FS_BMP_GUI)
  133. MoveScroll(pFsJpeg->file_page_now);//show file scroll bar
  134. DIR_MoveScroll(pFsJpeg->dir_page_now);
  135. #else
  136. MoveScroll(pFsJpeg->file_page_will * PER_PAGE + pFsJpeg->file_will);
  137. #endif
  138. FSGUI_CookFileItem(pFsJpeg->file_current);
  139. }
  140. //
  141. // FSGUI_Select :
  142. //       return : 0 -> invalid-key or change folder
  143. //                1 -> valid select
  144. int FSGUI_Select(int iSelect)       // select file range of all disc,panxing,2002-4-8
  145. {
  146.     int iRes = 1;
  147. #ifdef RECORD_PER_SECOND        //avoid bug when playing mp3  gerry  2-12-3 19:46
  148.     resumeMSF = 0;
  149. #endif
  150.     if (pFsJpeg->ControlArea == CNT_AREA_DIR)
  151.     {
  152.         if (iSelect > 0 && iSelect <= pFsJpeg->count_dir[pFsJpeg->gifsFuncBtn - FS_FUNC_MP3])
  153.         {
  154.             pFsJpeg->fsnav_dir_will = AnchorDir(iSelect - 1);
  155.             FSGUI_PreChangeDir(&(pFsJpeg->fsnav_dir_will), 0);
  156.             pFsJpeg->fsnav_dir_now = pFsJpeg->fsnav_dir_will;
  157. #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  158.             pFsJpeg->gifsbPreview = 0;//zhaoyanhua add 2004-2-24 17:25
  159. #else
  160. pFsJpeg->gifsbPreview = 1;
  161. #endif
  162.             iRes = 1;
  163.             refresh_dir_icon = 1;
  164.             Restore2PlayingDir();
  165.             #ifdef HANYANG_LR_CHANGE_PAGE
  166.             //When enter in DIR area, right to file area
  167.             FSGUI_Dir2FileArea();
  168.             #endif
  169.         }
  170.         else
  171.         {
  172.             invalid_key();
  173.             iRes = 0;
  174.         }
  175.     }
  176.     else    //It is File Area Now
  177.     {
  178. #if defined(MP3_DIRECT_SELECT)||defined(SUPPORT_CHANGE_FILE_DIR_PAGE)
  179.         if ((iSelect > 0) && (iSelect <= pFsJpeg->count_file[pFsJpeg->gifsFuncBtn - FS_FUNC_MP3]))
  180.         {
  181.             int i, tmp;
  182.             int iCount = 0;
  183.             int oldfsnav_dir_will; //Jeff 20020603
  184.             oldfsnav_dir_will = pFsJpeg->fsnav_dir_will;
  185.             for(i = 0; i < pFsJpeg->fsnav_dir_cnt; i++)
  186.             {
  187.                 tmp = CountSpecifyFile(i);
  188.                 if((iCount + tmp) >= iSelect)
  189.                     break;
  190.                 iCount += tmp;
  191.             }
  192.             pFsJpeg->fsnav_dir_will = i;
  193.             FSGUI_PreChangeDir(&(pFsJpeg->fsnav_dir_will), 0);
  194.             pFsJpeg->fsnav_dir_now = pFsJpeg->fsnav_dir_will;
  195.             iSelect = iSelect - iCount;
  196.             pFsJpeg->ControlArea = CNT_AREA_FILE; // Robert 20020521
  197.             //Jeff 20020627
  198.             if (pFsJpeg->gifsbZoomOK == 0)
  199. {
  200.                 if (oldfsnav_dir_will != pFsJpeg->fsnav_dir_will)
  201. {
  202.                     refresh_dir_page=1;
  203. #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  204.                     //Maoyong changed 2004.03.12, When select a file in other dir, avoid
  205.                     //(1)not draw dir in JPEG full screen mode, not destroy decoded graph in Frame Buf 0
  206.                     //(2)In preview, can't refresh dir because there is preivewed picture
  207.                     //(3)When Other type movie if playing
  208.                     if(pFsJpeg->iGraphMode == 0)
  209.                     {
  210.                         // 2004/04/28 yltseng, add one more condition that should not refresh DirIcon & DirList
  211.                         //if( !( pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG || IsOtherStatePlayMode() ) )
  212. if( ( pFsJpeg->gifsFuncBtn != FS_FUNC_JPEG )
  213. #ifdef SUPPORT_FILE_SYSTEM_MODE // 2004/06/10 yltseng
  214. && ( !IsOtherStatePlayMode() )
  215. #endif
  216. )
  217.                         {
  218.                             FSShowDirIcon();
  219.                             DirList();
  220.                         }
  221.                     }
  222. #else
  223. FSShowDirIcon();
  224. DirList();
  225. #endif
  226.                 }
  227. }
  228.         }
  229. #endif
  230.         if ((iSelect > 0) && (iSelect <= pFsJpeg->file_specify_in_dir))
  231.         {
  232.             FSGUI_FileSelect(iSelect);
  233.             pFsJpeg->ControlArea = CNT_AREA_FILE;  // Robert 20020521
  234. #if defined(NEW_MP3_GUI ) || defined(FS_BMP_GUI)
  235.             //Maoyong 2004.06.10 for GUI Bug in Preview.
  236.             if( (pFsJpeg->gifsbPreview == 1)&&(pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG) && !pFsJpeg->gbfsSlide )
  237.             {
  238.                 #ifdef FS_BMP_GUI//zhaoyanhua dd 2004-6-11 11:21
  239.                 ClearJpegPreviewBg();
  240.                 #else
  241.                 DrawRectCorner(Rect[DIR_RECT], CORNER_RAD, 1, DIR_STEP, DIR_AREA_BKGROUND_CRCB);
  242.                 #endif
  243.                 pFsJpeg->gifsbPreview = 0;
  244.             }
  245. #endif
  246.             //wanghaoying add 2003-11-10 17:16
  247.             //Des: VFD show the number selected
  248.             if(!(full_scrn&GOTO))
  249.                 disp_trk_now = iSelect;
  250.             iRes = 1;
  251.             return 1;
  252.         }
  253.         else
  254.             invalid_key();
  255.         iRes = 0;
  256.     }
  257.     return iRes;
  258. }
  259. void FSGUI_Stop()
  260. {
  261.     FSGUI_PreChangeDir(&(pFsJpeg->fsnav_dir_now), 0);
  262. #ifdef NEW_MP3_GUI
  263.     if (JPEG_Preview_drawed == JPEG_PREVIEW_IN_DIR_AREA )
  264.     {
  265.         ClearJpegPreviewBg();//zhaoyanhua changed 2004-6-11 11:29
  266.         //DrawRectCorner(Rect[DIR_RECT], CORNER_RAD, 1, 40, DIR_AREA_BKGROUND_CRCB);
  267.         //JPEG_Preview_drawed = DIR_LIST_IN_DIR_AREA ;
  268.     }
  269. #endif
  270.     refresh_dir_page = 1;   // insure dir page area can be refresh, panxing, 2002-1-22
  271.     refresh_file_page = 1;
  272.     FSGUI_Refresh();
  273. #if !(defined (NEW_MP3_GUI) || defined (FS_BMP_GUI))
  274. ClearArea(FS_AREA_PREVIEWJPG);
  275. #endif
  276.     if ((pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)
  277. #if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
  278.         || (pFsJpeg->gifsFuncBtn == FS_FUNC_GAME)
  279. #endif
  280. #ifdef SUPPORT_FILE_SYSTEM_MODE
  281.         || (pFsJpeg->gifsFuncBtn == FS_FUNC_OTHER)
  282. #endif
  283.         )
  284.     {
  285.         pFsJpeg->file_current = 0;
  286.         pFsJpeg->file_will = 0;
  287.         pFsJpeg->dir_current = 0;
  288.         pFsJpeg->fsnav_dir_will = 0;
  289.         pFsJpeg->fsnav_dir_now = 0;
  290.         FSGUI_PreChangeDir(&(pFsJpeg->fsnav_dir_now), 0);
  291. #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  292.         if (!(pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)) //when show JPEG,STOP should not change pFsJpeg->gifsbPreview.zhaoyanhua 3-7-9 9:08
  293. #endif
  294.             pFsJpeg->gifsbPreview = 1;
  295.     }
  296.     FSGUI_JpgUpdateOSD();
  297. }
  298. //
  299. // Draw mp3 main menu, fill framebuf by some difference color
  300. //
  301. void FSGUI_Menu()
  302. {
  303. #ifdef AUDIO_SHOW_SAVER
  304.     if (bDisableGUI) return;
  305. #endif
  306.     refresh_dir_page=1;
  307.     refresh_file_page=1;
  308.     
  309. //suqiaoli add 2004-10-10 ,solve FS_BMP_GUI LOGO mosaic bug ,
  310. //move set_disbuf_now(0) from fs9660.c ReadFile Function.
  311. #if defined (MP3_LARGE_GUI) || defined (FS_BMP_GUI)
  312.     set_disbuf_now(0);
  313. #endif
  314. #ifdef NEW_MP3_GUI
  315.     // background
  316.     #ifdef MP3_LARGE_GUI
  317.     FSGUI_FillFrameBuf(0,0, 720, 480, BK_GROUNDY,BK_CRCB);
  318.     #else
  319.     FSGUI_FillFrameBuf(0,0,352,288,BK_GROUNDY,BK_CRCB);
  320.     #endif
  321. #ifdef MONO_FSGUI //FS GUI, axel 2003-12-29 23:26
  322.     DrawRectCorner(Rect[DIR_RECT], CORNER_RAD, 1,1, DIR_AREA_BKGROUND_CRCB);
  323.     DrawRectCorner(Rect[FILE_RECT], CORNER_RAD,  1, 1, FILE_AREA_BKGROUND_CRCB);
  324. #else
  325.     DrawRectCorner(Rect[DIR_RECT], CORNER_RAD, 1,DIR_STEP, DIR_AREA_BKGROUND_CRCB);
  326.     DrawRectCorner(Rect[FILE_RECT], CORNER_RAD,  1, FILE_STEP, FILE_AREA_BKGROUND_CRCB);
  327. #endif
  328.     DrawButton();//to avoid GUI blinking zhaoyanhua add 2004-2-3 16:09
  329. #elif defined FS_BMP_GUI
  330.     // show background
  331.     FSGUI_DrawBackGround(BG_XSTART, BG_YSTART + 0, BG_XREPEAT, BG_YREPEAT,LAY_BG_3_1);
  332.     FSGUI_DrawBackGround(BG_XSTART, BG_YSTART + 0xaa, BG_XREPEAT, BG_YREPEAT,LAY_BG_3_2);
  333.     FSGUI_DrawBackGround(BG_XSTART, BG_YSTART + 0x17d, BG_XREPEAT, BG_YREPEAT, LAY_BG_3_3);
  334.     // dir background and file background
  335.     FSGUI_ShowBmpCornerRect(DIR_AREA_XSTART, DIR_AREA_YSTART, DIR_AREA_XLEN, DIR_AREA_YLEN);
  336.     FSGUI_ShowBmpCornerRect(FILE_AREA_XSTART, FILE_AREA_YSTART, FILE_AREA_XLEN, FILE_AREA_YLEN);
  337. DrawButton();//show top buttons,add by feeling 2004-06-14
  338. //draw the left and right edge of the info area
  339. FSGUI_LayoutBmp(LAY_PLAYING_BAR_3_1);
  340. FSGUI_LayoutBmp(LAY_PLAYING_BAR_3_3);
  341.      //draw the info area background
  342. FSGUI_DrawBackGround(fsArea[FS_AREA_PATHBACKGROUND].xStart ,
  343. fsArea[FS_AREA_PATHBACKGROUND].yStart,
  344. fsArea[FS_AREA_PATHBACKGROUND].xSize,
  345. fsArea[FS_AREA_PATHBACKGROUND].ySize,
  346. LAY_PLAYING_BAR_3_2);
  347. #else //NEW_MP3_GUI
  348. // background
  349. FSGUI_FillFrameBuf(0,0,352,288,BK_GROUNDY,BK_GROUNDCRCB);
  350. // high line
  351. FSGUI_FillFrameBuf(0,Y1,352,LIGHT_WID,WHITE_Y,WHITE_CRCB);
  352. FSGUI_FillFrameBuf(0, Y1+LIGHT_WID,
  353. X1, SHADOW_WID,
  354. BLACK_Y, BLACK_CRCB);
  355. FSGUI_FillFrameBuf(X1+LIGHT_WID+SHADOW_WID, Y1+LIGHT_WID,
  356. 352-X1-LIGHT_WID-SHADOW_WID, SHADOW_WID,
  357. BLACK_Y, BLACK_CRCB);
  358. FSGUI_FillFrameBuf(0, Y3,
  359. X1, LIGHT_WID,
  360. WHITE_Y,WHITE_CRCB);
  361. FSGUI_FillFrameBuf(X1+LIGHT_WID+SHADOW_WID, Y3,
  362. 352-X1-LIGHT_WID-SHADOW_WID, LIGHT_WID,
  363. WHITE_Y,WHITE_CRCB);
  364. FSGUI_FillFrameBuf(0, Y3+LIGHT_WID,
  365. 352, SHADOW_WID,
  366. BLACK_Y,BLACK_CRCB);
  367. FSGUI_FillFrameBuf(X1, Y1+LIGHT_WID,
  368. LIGHT_WID, Y3-Y1,
  369. WHITE_Y,WHITE_CRCB);
  370. FSGUI_FillFrameBuf(X1+LIGHT_WID, Y1+LIGHT_WID,
  371. SHADOW_WID, Y3-Y1-LIGHT_WID,
  372. BLACK_Y,BLACK_CRCB);
  373. DrawScroll();
  374. #endif //NEW_MP3_GUI
  375. #ifndef AUDIO_SHOW_SAVER
  376.     play_state = VCD_STATE_MP3_FILELIST;
  377. #endif
  378. #ifdef DISP_REGION_BOTTOM
  379. {
  380. if(t_disp)
  381. {
  382. osd_init();
  383. DispCookOSD0(1);//feeling, update the disp buf,2004/12/30
  384. }
  385. }
  386. #endif
  387. }
  388. UINT32  FSGUI_IsSelectable()
  389. {
  390.     //Jeff 20020521
  391.     if (((pFsJpeg->ControlArea == CNT_AREA_MP3BUTTON) && (pFsJpeg->gifsFuncBtn != FS_FUNC_MP3)) ||
  392.         (pFsJpeg->ControlArea==CNT_AREA_JPEGBUTTON) ||
  393. #if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
  394.         (pFsJpeg->ControlArea==CNT_AREA_GAMEBUTTON) ||
  395. #endif
  396. #ifdef SUPPORT_FILE_SYSTEM_MODE // Robert 021001
  397.         (pFsJpeg->ControlArea==CNT_AREA_OTHERBUTTON) ||
  398. #endif
  399. #ifdef SUPPORT_MIDI
  400.         (pFsJpeg->ControlArea==CNT_AREA_MIDIBUTTON) ||
  401. #endif
  402.         (pFsJpeg->ControlArea == CNT_AREA_DIR)
  403.         )
  404.     {
  405.         return 1;
  406.     } else
  407.         return 0;
  408. }
  409. void FSGUI_JpgPreview()
  410. {
  411.     UINT32 msf, len;
  412.     int iResJPG;
  413. #ifdef MP3_JPEG_COWORK
  414.     int last_file_pressed; //ycwen 2005/1/21 for JPEG Preview GUI
  415. #endif
  416. #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  417.     //refresh file list, not refresh dir list
  418.     FSGUI_RotateDiscIcon(0);//solve the problem when enter"return",the disc icon disappeared.zhaoyanhua 3-7-10 15:36
  419.     FSGUI_CookFileItem(pFsJpeg->file_current);
  420.     //ShowHL();
  421.     ShowCurrentFilePlaying();
  422.     ShowHL();//zhaoyanhua move it here. 2004-2-2 17:24
  423. #if defined (FS_BMP_GUI)
  424.     if (flagRefresh == 1)//when return from refresh,show file scroll
  425.     {
  426.         MoveScroll(pFsJpeg->file_page_will);
  427.         flagRefresh = 0;
  428.     }
  429.     else if (pFsJpeg->file_current % PER_PAGE == 0)
  430.         MoveScroll(pFsJpeg->file_page_will);
  431. #else
  432.     MoveScroll(pFsJpeg->file_page_will * PER_PAGE + pFsJpeg->file_will);
  433. #endif
  434. #else
  435. ClearArea(FS_AREA_PREVIEWJPG);
  436. // list directories and files, scroll bar,etc, panxing, 2002-1-22
  437. FSGUI_Refresh();
  438. #endif
  439.     disp_trk_now = FSGUI_GetDispTrack(); //Jeff 20020607
  440.     FSGUI_JpgUpdateOSD();// same as dvdcode0115, panxing, 2002-1-19
  441.     msf = iso9660_file[pFsJpeg->file_array[pFsJpeg->file_current]].loc;
  442.     len = iso9660_file[pFsJpeg->file_array[pFsJpeg->file_current]].size;
  443.     ClearCommand();
  444. #if defined (NEW_MP3_GUI)
  445.     if (JPEG_Preview_drawed == DIR_LIST_IN_DIR_AREA )
  446.     {
  447.         DrawRectCorner(Rect[DIR_RECT], CORNER_RAD, 1, 0,PREVIEW_BKGROUND_CRCB);
  448.         JPEG_Preview_drawed = JPEG_PREVIEW_IN_DIR_AREA ;
  449.     }
  450.     else   //not redraw all the background to avoid blinkling when preview picture. zhaoyanhua note
  451.         FSGUI_FillFrameBuf(Rect[ PREVIEW_RECT].xStart, Rect[ PREVIEW_RECT].yStart,
  452.                            Rect[ PREVIEW_RECT].xSize,  Rect[ PREVIEW_RECT].ySize,
  453.                            PREVIEW_BKGROUND_Y, PREVIEW_BKGROUND_CRCB);
  454. #elif defined FS_BMP_GUI
  455.     ClearJpegPreviewBg();
  456.     if (JPEG_Preview_drawed == DIR_LIST_IN_DIR_AREA )
  457.     {
  458.         JPEG_Preview_drawed = JPEG_PREVIEW_IN_DIR_AREA ;
  459.         //when preview jpg pic,dir scroll bar cannot exit.
  460.         DIR_DrawScroll();
  461.     }
  462. #endif
  463. #ifdef  MP3_JPEG_COWORK
  464.     last_file_pressed = pFsJpeg->file_current; //ycwen 2005/1/21 Show highlight correctly when press UP/DOWN quickly when preview jpg
  465.     while(check_input_interval()==0)
  466.     {
  467.         if((pFsJpeg->gifsFuncBtn==FS_FUNC_MP3)&&(back_sign==1))
  468.         {
  469.             //FSGUI_Refresh();//refresh the mp3 GUI
  470.             return;//prevent conflict between JPEG and mp3
  471.         }
  472.         polling();
  473.         if(last_file_pressed!=pFsJpeg->file_current)
  474.         {
  475.             SelectHL();
  476.             last_file_pressed = pFsJpeg->file_current; 
  477.         }
  478.         //for the msf and len of current jpeg pic
  479.         msf = iso9660_file[pFsJpeg->file_array[pFsJpeg->file_current]].loc;
  480.         len = iso9660_file[pFsJpeg->file_array[pFsJpeg->file_current]].size;
  481.     }
  482.     //pFsJpeg->gifsbPreview = 0;//prevent next enter!//wuxiaofeng marked 2004-04-19
  483.     //ycwen 2005/1/31 If user switch to NONE-JPEG Area, then we should STOP the Jpeg function.
  484.     //                (For example, if user switch to MPEG file, and Jpeg still call decode function, then system will reset)
  485.     if (! ((pFsJpeg->ControlArea==CNT_AREA_JPEGBUTTON)||(pFsJpeg->ControlArea==CNT_AREA_FILE)) )
  486.         return;
  487. #endif
  488. #ifdef NEW_MP3_GUI
  489.     // joshua, 2004/10/18, added for clearing special-effect mode
  490.     #ifdef JPG_EFFECT
  491.         Jpg_effect_mode = 0; 
  492.     #endif
  493.     iResJPG = Jpg_Main(msf, len,
  494.         Rect[SHOW_JPEG_RECT].xStart,
  495.         Rect[SHOW_JPEG_RECT].yStart,
  496.         Rect[SHOW_JPEG_RECT].xSize,
  497.         Rect[SHOW_JPEG_RECT].ySize);
  498. #elif defined FS_BMP_GUI//zhaoyanhua 2004-6-11 9:04
  499.     iResJPG = Jpg_Main(msf, len,
  500. fsArea[FS_AREA_PREVIEWJPG].xStart, //x must be 8*x
  501. fsArea[FS_AREA_PREVIEWJPG].yStart, //y must be 2*x
  502. fsArea[FS_AREA_PREVIEWJPG].xSize,
  503. fsArea[FS_AREA_PREVIEWJPG].ySize);
  504. #else
  505. iResJPG = Jpg_Main(msf, len,
  506. fsArea[FS_AREA_PREVIEWJPG].xStart+2, //x must be 8*x
  507. fsArea[FS_AREA_PREVIEWJPG].yStart+2, //y must be 2*x
  508. fsArea[FS_AREA_PREVIEWJPG].xSize-4,
  509. fsArea[FS_AREA_PREVIEWJPG].ySize-4);
  510. #endif
  511. #ifdef NOT_SHOW_X_WHEN_JPEG_ERROR //Juse as the name!Jack added 04/11/16 
  512.     #ifdef  MP3_JPEG_COWORK
  513.     if(pFsJpeg->gifsFuncBtn!=FS_FUNC_MP3)
  514.     #endif
  515.     {
  516.         if (iResJPG < 0)
  517.         {
  518.             psprintf(RegionValStr[REGION1],"JPEG ERROR");
  519.             PrintOsdMsg(STR_OS_SPACE,REGION1,1,1);
  520.         }
  521.     }    
  522. #else
  523. #ifdef  MP3_JPEG_COWORK//prevent drawing the X when switching to mp3
  524.     if(pFsJpeg->gifsFuncBtn!=FS_FUNC_MP3)
  525. #endif
  526.     {
  527. #if defined (NEW_MP3_GUI)
  528.         //Maoyong 2004.04.19 for JPEG preview display and flow bug.
  529.         if (iResJPG < 0)
  530.         {
  531.             if(pFsJpeg->ControlArea != CNT_AREA_DIR)    //Maoyong 2004.03.11
  532.             {
  533.                 BYTE x = 90, y = 140;
  534.                 //wanghaoying 2004-8-4 20:48, only for different defination
  535.                 #ifdef MP3_LARGE_GUI
  536.                 x = 140; y = 240;
  537.                 #endif
  538.         // deal with error, panxing, 2002-1-22
  539.         #if (defined(BBK_DVD)||defined(YADAI_DVD))//2004-3-30 16:30 LIJD
  540.         FSGUI_ShowString(90,140,"", FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  541.         #else
  542.         FSGUI_ShowString(90,140,"X", FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  543.         #endif
  544.          }
  545.      }
  546. #else
  547. if (iResJPG < 0) {
  548. // deal with error, panxing, 2002-1-22
  549. FSGUI_ShowString(fsArea[FS_AREA_PREVIEWJPG].xStart+(fsArea[FS_AREA_PREVIEWJPG].xSize-10)/2,
  550. fsArea[FS_AREA_PREVIEWJPG].yStart+(fsArea[FS_AREA_PREVIEWJPG].ySize-12)/2,
  551. "X", FS_FONTCOLOR_FILE_Y, FS_FONTCOLOR_FILE_CrCb);
  552. }
  553. #endif
  554.     }
  555. #endif //end #ifdef NOT_SHOW_X_WHEN_JPEG_ERROR    
  556. }
  557. UINT32 FSGUI_CmdPlay()
  558. {
  559. UINT32  iRes;
  560. iRes = CMD_FUNC | CMD_FUNC_PLAY;
  561. //Jeff 20020418
  562. if ((pFsJpeg->ControlArea==CNT_AREA_MP3BUTTON) || (pFsJpeg->ControlArea==CNT_AREA_JPEGBUTTON)
  563. #if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
  564. || (pFsJpeg->ControlArea==CNT_AREA_GAMEBUTTON)
  565. #endif
  566. )
  567. {
  568. iRes = FSGUI_CmdEnter();
  569. return iRes;
  570. }//NONO 2-4-2 18:09
  571. //#endif
  572. if (pFsJpeg->ControlArea == CNT_AREA_DIR) {
  573. iRes = FSGUI_CmdEnter();
  574. return iRes;
  575. }
  576. if ((pFsJpeg->ControlArea == CNT_AREA_FILE) && ((pFsJpeg->gifsFuncBtn == FS_FUNC_MP3)
  577. #if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
  578. || (pFsJpeg->gifsFuncBtn == FS_FUNC_GAME)
  579. #endif
  580. #ifdef SUPPORT_FILE_SYSTEM_MODE
  581. || (pFsJpeg->gifsFuncBtn == FS_FUNC_OTHER) // Robert 021007
  582. #endif
  583. #ifdef SUPPORT_MIDI
  584. || (pFsJpeg->gifsFuncBtn==FS_FUNC_MIDI)
  585. #endif
  586. ))
  587. {
  588. iRes = FSGUI_CmdEnter();
  589. return iRes;
  590. }
  591. if (((pFsJpeg->gifsFuncBtn == FS_FUNC_MP3)
  592. #ifdef SUPPORT_MIDI
  593.     || (pFsJpeg->gifsFuncBtn==FS_FUNC_MIDI)
  594. #endif
  595.         )
  596.         && (play_state != VCD_STATE_MP3_FILELIST))
  597. {
  598. sys_cmd = 0;
  599. iRes=0;
  600. }
  601. else if (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)
  602. {
  603. #ifdef MENU_STOP_EXCHANGE
  604. #ifndef SDRAM_16Mb_Mode
  605.        if(pFsJpeg->ControlArea != CNT_AREA_OTHERBUTTON)
  606.            pFsJpeg->g_nJpegMode=JPEG_THUMBNAIL_MODE;       //xulf 2003-12-6
  607. #endif
  608. #endif
  609. #ifdef SUPPORT_FILE_SYSTEM_MODE
  610.    if(pFsJpeg->ControlArea != CNT_AREA_OTHERBUTTON)
  611. #endif//nono 20040109
  612.    {
  613. pFsJpeg->gbfsSlide = 1;
  614. #ifdef NOT_SHOW_PIC_READ_RATE//terry,2004/1/8 06:33PM
  615. extern const UINT8 pic_cd_str[17];//axel 2004/5/17 09:45
  616.         if( (strncmp(RegionValStr[REGION1], pic_cd_str, 15) != 0)||(timeout_osd[REGION1]==0) )
  617. #endif
  618.         {
  619. PrintOsdMsg(STR_OS_SEQUENCE,REGION1,1,0);
  620. }
  621. if (rep_mode==REPEAT_TRACK) {
  622. rep_mode = 0;
  623. }
  624.    }
  625. #ifdef SUPPORT_FILE_SYSTEM_MODE//nono 20040109
  626.    else//if(pFsJpeg->ControlArea != CNT_AREA_OTHERBUTTON )
  627.    {
  628.     iRes = FSGUI_CmdEnter();
  629. return iRes;
  630.    }
  631. #endif//#ifdef SUPPORT_FILE_SYSTEM_MODE
  632. }
  633. return iRes;
  634. }
  635. void Will2Playing(void)
  636. {
  637. #ifdef POWER_RESUME
  638. if ( IsTheSameMP3 ( ) )
  639. {
  640. pFsJpeg -> fsnav_trk_will = ReadSameMP3Para ( 1 ) ;
  641. pFsJpeg -> file_will = pFsJpeg->fsnav_trk_will % PER_PAGE ;
  642. pFsJpeg -> file_page_will = pFsJpeg->fsnav_trk_will / PER_PAGE ;
  643. }
  644. /* read the dir recorded in i2c , and set file_will and file_page_will ,
  645.    added by caiyh , 14:12 , Nov 5th , 2004 */
  646. #endif   // POWER_RESUME
  647. pFsJpeg->file_current = pFsJpeg->file_will;
  648. pFsJpeg->file_page_now = pFsJpeg->file_page_will;
  649. pFsJpeg->fsnav_trk_now = pFsJpeg->fsnav_trk_will;
  650. }
  651. void Playing2Will(void)
  652. {
  653. pFsJpeg->file_will = pFsJpeg->file_current;
  654. pFsJpeg->file_page_will = pFsJpeg->file_page_now;
  655. pFsJpeg->fsnav_trk_will = pFsJpeg->fsnav_trk_now;
  656. }
  657. void Restore2PlayingFile(void)
  658. {
  659. if (pFsJpeg->file_page_now != pFsJpeg->file_page_will)
  660. {
  661. pFsJpeg->file_page_will = pFsJpeg->file_page_now;
  662. PrepareForChangeFilePage(pFsJpeg->file_page_now, pFsJpeg->fsnav_trk_now, 2);
  663. if ((pFsJpeg->gifsState != FS_STATE_JPEG) || (pFsJpeg->gifsState != FS_STATE_GAME))
  664. {
  665. ShowFileIcon();
  666. FileList();
  667. }
  668. }
  669. Playing2Will();
  670. }
  671. void Restore2PlayingDir(void)
  672. {
  673.     int playing;
  674.     int will;
  675.     playing = antiAnchorDir(pFsJpeg->fsnav_dir_now);
  676.     will = antiAnchorDir(pFsJpeg->fsnav_dir_will);
  677.     // for restore dir hl's location, panxing, 2002-4-12
  678. if ((will / PER_PAGE) != (playing / PER_PAGE))
  679.     {
  680.         // in different dir page,panxing,2002-4-12
  681. CalcDirNow(&(pFsJpeg->fsnav_dir_now));
  682.         if ((pFsJpeg->gifsState != FS_STATE_JPEG) && (pFsJpeg->gifsState != FS_STATE_GAME))
  683.         {
  684.             FSShowDirIcon();
  685.             DirList();
  686.         }
  687.     }
  688. pFsJpeg->dir_current = playing % PER_PAGE;
  689. pFsJpeg->fsnav_dir_will = pFsJpeg->fsnav_dir_now;
  690. }
  691. UINT32  FSGUI_CmdRight()
  692. {
  693.     UINT32 iRes=0;
  694. #ifdef  MP3_JPEG_COWORK
  695.         old_time=get_stc_32_inline();//get the press time
  696. #endif
  697.     if (pFsJpeg->gifsState == FS_STATE_JPEG)
  698.     {
  699. #ifdef JPG_EFFECT
  700. sys_cmd = (CMD_SELECT | CMD_FUNC_GAME_R);
  701. #else
  702. sys_cmd = iRes;
  703. #endif
  704.         return sys_cmd;
  705.     }
  706.     if (pFsJpeg->ControlArea == CNT_AREA_FILE)
  707.     {
  708. #ifdef SUPPORT_MIDI
  709.         if (pFsJpeg->gifsMidiCount)
  710.             pFsJpeg->ControlArea = CNT_AREA_MIDIBUTTON;
  711.         else
  712. #endif
  713. #ifdef SUPPORT_FILE_SYSTEM_MODE // Robert 021001
  714.         if (pFsJpeg->gifsOtherCount)
  715.             pFsJpeg->ControlArea = CNT_AREA_OTHERBUTTON;
  716.         else
  717. #endif
  718. #if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
  719.             if (pFsJpeg->gifsGAMECount)
  720.                 pFsJpeg->ControlArea = CNT_AREA_GAMEBUTTON;
  721.             else
  722. #endif
  723.                 if (pFsJpeg->gifsJPEGCount)
  724.                     pFsJpeg->ControlArea = CNT_AREA_JPEGBUTTON;
  725.                 else
  726.                     pFsJpeg->ControlArea = CNT_AREA_MP3BUTTON;
  727.     }
  728.     else if(pFsJpeg->ControlArea == CNT_AREA_DIR)
  729.     {
  730.         pFsJpeg->ControlArea = CNT_AREA_FILE;
  731.         pFsJpeg->gifsbPreview = 1;  //Maoyong 2004.05.31
  732. #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  733.         JPEG_Preview_drawed = DIR_LIST_IN_DIR_AREA;
  734.         //pFsJpeg->gifsbPreview = 1;
  735. #endif
  736.     }
  737.     else if (pFsJpeg->ControlArea == CNT_AREA_MP3BUTTON)
  738.     {
  739.         if (pFsJpeg->gifsJPEGCount)
  740.             pFsJpeg->ControlArea = CNT_AREA_JPEGBUTTON;
  741. #if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
  742.         else if (pFsJpeg->gifsGAMECount)
  743.             pFsJpeg->ControlArea = CNT_AREA_GAMEBUTTON;
  744. #endif
  745. #ifdef SUPPORT_FILE_SYSTEM_MODE // Robert 021001
  746.         else if (pFsJpeg->gifsOtherCount)
  747.             pFsJpeg->ControlArea = CNT_AREA_OTHERBUTTON;
  748. #endif
  749. #ifdef SUPPORT_MIDI
  750.         else if (pFsJpeg->gifsMidiCount)
  751.             pFsJpeg->ControlArea = CNT_AREA_MIDIBUTTON;
  752. #endif
  753.         else
  754.             pFsJpeg->ControlArea = CNT_AREA_FILE;
  755.     }
  756.     else if (pFsJpeg->ControlArea == CNT_AREA_JPEGBUTTON)
  757.     {
  758. #if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
  759.         if (pFsJpeg->gifsGAMECount)
  760.             pFsJpeg->ControlArea = CNT_AREA_GAMEBUTTON;
  761.         else
  762. #endif
  763. #ifdef SUPPORT_FILE_SYSTEM_MODE // Robert 021001
  764.             if (pFsJpeg->gifsOtherCount)
  765.                 pFsJpeg->ControlArea = CNT_AREA_OTHERBUTTON;
  766.             else
  767. #endif
  768. #ifdef SUPPORT_MIDI
  769.         if(pFsJpeg->gifsMidiCount)
  770.             pFsJpeg->ControlArea = CNT_AREA_MIDIBUTTON;
  771.         else
  772. #endif
  773.         {
  774.             pFsJpeg->ControlArea = CNT_AREA_FILE;
  775. #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  776.             JPEG_Preview_drawed = DIR_LIST_IN_DIR_AREA;
  777.             pFsJpeg->gifsbPreview = 1;
  778. #endif
  779.         }
  780.     }
  781. #if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
  782.     else if (pFsJpeg->ControlArea == CNT_AREA_GAMEBUTTON)
  783.     {
  784. #ifdef SUPPORT_FILE_SYSTEM_MODE // Robert 021001
  785.         if (pFsJpeg->gifsOtherCount)
  786.             pFsJpeg->ControlArea = CNT_AREA_OTHERBUTTON;
  787.         else
  788. #endif
  789.          {
  790.             pFsJpeg->ControlArea = CNT_AREA_FILE;
  791. #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  792.             if (pFsJpeg->g_nJpegMode == JPEG_NORMAL_MODE)
  793.                 pFsJpeg->gifsbPreview = 1;
  794. #endif
  795.          }
  796.     }
  797. #endif
  798. #ifdef SUPPORT_FILE_SYSTEM_MODE // Robert 021001
  799.     else if (pFsJpeg->ControlArea == CNT_AREA_OTHERBUTTON)
  800.     {
  801. #ifdef SUPPORT_MIDI
  802.         if (pFsJpeg->gifsMidiCount)
  803.             pFsJpeg->ControlArea = CNT_AREA_MIDIBUTTON;
  804.         else
  805. #endif
  806.         pFsJpeg->ControlArea = CNT_AREA_FILE;
  807.     }
  808. #endif
  809. #ifdef SUPPORT_MIDI
  810.     else if (pFsJpeg->ControlArea == CNT_AREA_MIDIBUTTON)
  811.     {
  812.         pFsJpeg->ControlArea = CNT_AREA_FILE;
  813.     }
  814. #endif
  815. #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  816.     //avoid GUI blinking.zhaoyanhua add 2004-2-3 11:16
  817.     //SelectHL();
  818.     ShowHL();
  819. #else
  820. SelectHL();
  821. #endif
  822.     iRes = 0x20000 | sys_cmd;
  823.     sys_cmd = 0;
  824.     return iRes;
  825. }
  826. //Maoyong 2004.05.31 for clear JPEG Preview Background
  827. void ClearJpegPreviewBg(void)
  828. {
  829. #ifdef NEW_MP3_GUI
  830.     DrawRectCorner(Rect[DIR_RECT], CORNER_RAD, 1, 40, DIR_AREA_BKGROUND_CRCB);
  831.     JPEG_Preview_drawed = DIR_LIST_IN_DIR_AREA;
  832. #elif defined (FS_BMP_GUI)//zhaoyanhua add 2004-6-11 10:47
  833.     int i = 0;
  834.     FSGUI_DrawBackGround(fsArea[FS_AREA_DIRITEM].xStart + 8,
  835.                             fsArea[FS_AREA_DIRITEM].yStart - 12  ,
  836.                             fsArea[FS_AREA_DIRITEM].xSize- 16,
  837.                             1,LAY_FILE_BG_10_0);
  838.     for (i = 0; i < 8; i++)//8 sections
  839.     {
  840.         //clear from the position of icon.
  841.         FSGUI_DrawBackGround(fsArea[FS_AREA_DIRITEM].xStart,
  842.                             fsArea[FS_AREA_DIRITEM].yStart + 32 * i ,
  843.                             fsArea[FS_AREA_DIRITEM].xSize,
  844.                             1,
  845.                             LAY_FILE_BG_10_1 + i );
  846.     }
  847.     FSGUI_DrawBackGround(fsArea[FS_AREA_DIRITEM].xStart + 8,
  848.                             fsArea[FS_AREA_DIRITEM].yStart + 32 * 8  ,
  849.                             fsArea[FS_AREA_DIRITEM].xSize - 16,
  850.                             1,LAY_FILE_BG_10_9);
  851.     JPEG_Preview_drawed = DIR_LIST_IN_DIR_AREA;
  852. #else
  853. ClearArea(FS_AREA_PREVIEWJPG);
  854. #endif
  855. }
  856. //Maoyong 2004.07.01 when in JPEG state, enter DIR area should refresh for newer GUI types
  857. void FSGUI_ChkJpgStRedrawDirArea(void)
  858. {
  859. #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  860.         if( (pFsJpeg->gifsState == FS_STATE_LIST)
  861.         && (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)
  862.         )
  863.         {
  864.             //Maoyong changed 2004.03.13.When exit preview to DIR, directly clear preview bground.
  865.             //Avoid Bug:Rapid Operation will make DIR bground has preview bground in part.
  866.             //The Bug will happen when picture take long time to show, user enter L/R rapidly
  867.             pFsJpeg->gifsbPreview = 0;
  868.             #if !defined (FS_BMP_GUI)
  869.             DrawRectCorner(Rect[DIR_RECT], CORNER_RAD, 1, 40, DIR_AREA_BKGROUND_CRCB);
  870.             #endif
  871.             JPEG_Preview_drawed = DIR_LIST_IN_DIR_AREA;
  872.             refresh_dir_icon = 1;
  873.             FSShowDirIcon();
  874.             refresh_dir_page = 1;
  875.             #ifdef FS_BMP_GUI
  876.             DIR_MoveScroll(pFsJpeg->dir_page_now);//show dir scroll bar
  877.             #endif
  878.             DirList();
  879.             ShowCurrentDirPlaying();
  880.         }
  881. #endif //#if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  882. }
  883. #ifdef HANYANG_LR_CHANGE_PAGE
  884. //Maoyong for hanyang 2004.07.01
  885. void FSGUI_Dir2FileArea(void)
  886. {
  887.     //When enter in DIR area, enter/select right to file area
  888.     pFsJpeg->ControlArea = CNT_AREA_FILE;
  889.     #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  890.     ShowHL();
  891.     #else
  892. SelectHL();
  893.     #endif
  894. }
  895. void FSGUI_File2DirArea(void)
  896. {
  897.     pFsJpeg->ControlArea = CNT_AREA_DIR;
  898.     FSGUI_ChkJpgStRedrawDirArea();
  899. #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  900.     ShowHL();
  901. #else
  902. SelectHL();
  903. #endif
  904. }
  905. #endif  //HANYANG_LR_CHANGE_PAGE
  906. void FSGUI_FileAreaUpdownRefresh(void)
  907. {
  908.     if ((pFsJpeg->gifsState == FS_STATE_LIST) && (pFsJpeg->gifsFuncBtn != FS_FUNC_MP3))
  909.     {
  910.         Will2Playing();
  911.         pFsJpeg->gifsbPreview = 1;
  912.     }
  913. #ifdef FSGUI_NO_BLINK_SCROLL
  914. MoveScroll(pFsJpeg->file_page_will * PER_PAGE + pFsJpeg->file_will,SCROLLBAR_UP);
  915. up_down_done=1;
  916. #elif !defined(FS_BMP_GUI)
  917. MoveScroll(pFsJpeg->file_page_will * PER_PAGE + pFsJpeg->file_will);
  918. #endif
  919.     if (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)
  920.     {
  921.         _JPGBreak();
  922.         jpg_break_up_down = 1;    //Maoyong 2004.05.19
  923. //Maoyong 2004.05.31,when IR up/down, should clear current preview picture
  924. #ifdef NEW_MP3_GUI
  925.         FSGUI_FillFrameBuf(Rect[ PREVIEW_RECT].xStart, Rect[ PREVIEW_RECT].yStart,
  926.                            Rect[ PREVIEW_RECT].xSize,  Rect[ PREVIEW_RECT].ySize,
  927.                            PREVIEW_BKGROUND_Y, PREVIEW_BKGROUND_CRCB);
  928. #else
  929.     #if !defined (FS_BMP_GUI)
  930.         ClearArea(FS_AREA_PREVIEWJPG);
  931. #endif
  932. #endif
  933.     }
  934. }
  935. UINT32  FSGUI_CmdLeft()
  936. {
  937.     UINT32 iRes=0;
  938. #ifdef  MP3_JPEG_COWORK
  939.         old_time=get_stc_32_inline();//get the press time
  940. #endif
  941.     if (pFsJpeg->gifsState == FS_STATE_JPEG)
  942.     {
  943. #ifdef JPG_EFFECT
  944. sys_cmd = (CMD_SELECT | CMD_FUNC_GAME_L);
  945. #else
  946. sys_cmd = iRes;
  947. #endif
  948.         return sys_cmd;
  949.     }
  950.     if (pFsJpeg->ControlArea == CNT_AREA_FILE)
  951.     {
  952.         pFsJpeg->ControlArea = CNT_AREA_DIR;
  953.         FSGUI_ChkJpgStRedrawDirArea();
  954.         iRes = 0x20000 | sys_cmd;
  955.         sys_cmd = 0;
  956.     }
  957.     else if (pFsJpeg->ControlArea == CNT_AREA_DIR)
  958.     {
  959.         if (pFsJpeg->gifsMP3Count)
  960.             pFsJpeg->ControlArea = CNT_AREA_MP3BUTTON;
  961.         else if (pFsJpeg->gifsJPEGCount)
  962.             pFsJpeg->ControlArea = CNT_AREA_JPEGBUTTON;
  963. #if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
  964.         else if (pFsJpeg->gifsGAMECount)
  965.             pFsJpeg->ControlArea = CNT_AREA_GAMEBUTTON;
  966. #endif
  967. #ifdef SUPPORT_FILE_SYSTEM_MODE // Robert 020930
  968.         else if (pFsJpeg->gifsOtherCount)
  969.             pFsJpeg->ControlArea = CNT_AREA_OTHERBUTTON;
  970. #endif
  971. #ifdef SUPPORT_MIDI
  972.         else if (pFsJpeg->gifsMidiCount)
  973.             pFsJpeg->ControlArea = CNT_AREA_MIDIBUTTON;
  974. #endif
  975.     }
  976.     else if (pFsJpeg->ControlArea == CNT_AREA_MP3BUTTON)
  977.     {
  978.         pFsJpeg->ControlArea = CNT_AREA_DIR;
  979.         FSGUI_ChkJpgStRedrawDirArea();
  980.     }
  981.     else if(pFsJpeg->ControlArea == CNT_AREA_JPEGBUTTON)
  982.     {
  983.         if (pFsJpeg->gifsMP3Count)
  984.             pFsJpeg->ControlArea = CNT_AREA_MP3BUTTON;
  985.         else
  986.         {
  987.             pFsJpeg->ControlArea = CNT_AREA_DIR;
  988.             FSGUI_ChkJpgStRedrawDirArea();
  989.         }
  990.     }
  991. #if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
  992.     else if(pFsJpeg->ControlArea == CNT_AREA_GAMEBUTTON)
  993.     {
  994.         if (pFsJpeg->gifsJPEGCount)
  995.             pFsJpeg->ControlArea = CNT_AREA_JPEGBUTTON;
  996.         else if (pFsJpeg->gifsMP3Count)
  997.             pFsJpeg->ControlArea = CNT_AREA_MP3BUTTON;
  998.         else
  999.             pFsJpeg->ControlArea = CNT_AREA_DIR;
  1000.     }
  1001. #endif
  1002. #ifdef SUPPORT_FILE_SYSTEM_MODE // Robert 020930
  1003.     else if (pFsJpeg->ControlArea == CNT_AREA_OTHERBUTTON)
  1004.     {
  1005. #if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
  1006.         if (pFsJpeg->gifsGAMECount)
  1007.             pFsJpeg->ControlArea = CNT_AREA_GAMEBUTTON;
  1008.         else
  1009. #endif
  1010.             if (pFsJpeg->gifsJPEGCount)
  1011.                 pFsJpeg->ControlArea = CNT_AREA_JPEGBUTTON;
  1012.             else if (pFsJpeg->gifsMP3Count)
  1013.                 pFsJpeg->ControlArea = CNT_AREA_MP3BUTTON;
  1014.             else
  1015.                 pFsJpeg->ControlArea = CNT_AREA_DIR;
  1016.     }
  1017. #endif
  1018. #ifdef SUPPORT_MIDI
  1019.     else if (pFsJpeg->ControlArea == CNT_AREA_MIDIBUTTON)
  1020.     {
  1021.         #ifdef SUPPORT_FILE_SYSTEM_MODE
  1022.         if (pFsJpeg->gifsOtherCount)
  1023.             pFsJpeg->ControlArea = CNT_AREA_OTHERBUTTON;
  1024.         else
  1025.         #endif
  1026.         #if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
  1027.         if (pFsJpeg->gifsGAMECount) //axel modified 2004/7/28
  1028.             pFsJpeg->ControlArea = CNT_AREA_GAMEBUTTON;
  1029.         else
  1030.         #endif
  1031.             if(pFsJpeg->gifsJPEGCount)
  1032.                 pFsJpeg->ControlArea = CNT_AREA_JPEGBUTTON;
  1033.             else if(pFsJpeg->gifsMP3Count)
  1034.                 pFsJpeg->ControlArea = CNT_AREA_MP3BUTTON;
  1035.             else
  1036.                 pFsJpeg->ControlArea = CNT_AREA_DIR;
  1037.     }
  1038. #endif //SUPPORT_MIDI
  1039. #ifdef MP3_TXT_DISPLAY//zhaoyanhua add 2003-9-1 17:49
  1040.     if ((MP3_Lyrics_Drawed == MP3_LYRICS_IN_DIR_AREA)
  1041.       && (pFsJpeg->ControlArea == CNT_AREA_DIR)
  1042.       && (pFsJpeg->gifsFuncBtn == FS_FUNC_MP3))
  1043.     {
  1044.         DrawRectCorner(Rect[DIR_RECT], CORNER_RAD, 1, DIR_STEP, DIR_AREA_BKGROUND_CRCB);
  1045.         refresh_dir_icon = 1;
  1046.         FSShowDirIcon();
  1047.         refresh_dir_page = 1;
  1048.         DirList();
  1049.         MP3_Lyrics_Drawed = DIR_LIST_IN_DIR_AREA;
  1050.     }
  1051. #endif/*MP3_TXT_DISPLAY*/
  1052. #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  1053.     //avoid GUI blinking.zhaoyanhua 2004-2-2 16:25
  1054.     //SelectHL();
  1055.     ShowHL();
  1056. #else
  1057. SelectHL();
  1058. #endif
  1059.     iRes = 0x20000 | sys_cmd;
  1060.     sys_cmd = 0;
  1061.     return iRes;
  1062. }
  1063. UINT32  FSGUI_CmdDown()
  1064. {
  1065.     UINT32 iRes=0;
  1066. #ifdef  MP3_JPEG_COWORK
  1067.     old_time=get_stc_32_inline();//get the press time
  1068. #endif
  1069.     if (pFsJpeg->gifsState == FS_STATE_JPEG)
  1070.     {
  1071. #ifdef JPG_EFFECT
  1072. sys_cmd = (CMD_SELECT | CMD_FUNC_GAME_DN);
  1073. #else
  1074. sys_cmd = iRes;
  1075. #endif
  1076.         return sys_cmd;
  1077.     }
  1078.     if ((pFsJpeg->ControlArea == CNT_AREA_FILE)) {
  1079.         if (pFsJpeg->file_will < (pFsJpeg->File_Count - 1))
  1080.         {
  1081.             // needn't change file page,panxing,2002-4-15
  1082.             (pFsJpeg->file_will)++;
  1083.             pFsJpeg->fsnav_trk_will = pFsJpeg->file_array[pFsJpeg->file_will] - pFsJpeg->first_mp3_entry;
  1084.         }
  1085.         else
  1086.         {
  1087.             // change file page now, panxing, 2002-4-15
  1088.             if (pFsJpeg->file_page_will < (pFsJpeg->File_Page_Count - 1))
  1089.             {
  1090.                 pFsJpeg->file_page_will++;
  1091.                 PrepareForChangeFilePage(pFsJpeg->file_page_will, 0, 0);
  1092.                 ShowFileIcon();
  1093.                 FileList();
  1094. #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  1095.                 ShowCurrentFilePlaying();//if refresh page, must redraw the current file playing .zhaoyanhua add 2004-2-3 9:12
  1096.     #ifdef FS_BMP_GUI
  1097.                 MoveScroll(pFsJpeg->file_page_will);
  1098. #endif
  1099. #endif
  1100.             }
  1101. //when show last file in a dir,down button can't use,suqiaoli add 2004-10-9            
  1102. #if defined(FSGUI_NO_BLINK_SCROLL) || defined (FS_BMP_GUI)
  1103. else
  1104. {
  1105. invalid_key();       //xulf
  1106. sys_cmd = iRes;
  1107. return iRes;
  1108. }
  1109. #endif
  1110.         }
  1111. #ifdef MP3_LARGE_GUI
  1112.         if ((pFsJpeg->gifsState == FS_STATE_LIST) && (pFsJpeg->gifsFuncBtn != FS_FUNC_MP3))
  1113.         {
  1114.             Will2Playing();  // do preview, panxing,2002-4-15
  1115.             pFsJpeg->gifsbPreview = 1;
  1116.         }
  1117.         MoveScroll(pFsJpeg->file_page_will * PER_PAGE + pFsJpeg->file_will);
  1118. #else
  1119.         FSGUI_FileAreaUpdownRefresh();
  1120. #endif
  1121.         sys_cmd = CMD_SELECT|CMD_FUNC_GAME_DN;
  1122.         iRes = 0x20000|sys_cmd;
  1123.         sys_cmd = 0;        //avoid to receive another sys_cmd when out mainloop,panxing,2002-4-13
  1124. #ifdef MP3_LARGE_GUI
  1125.         //Jeff 20020509
  1126.         if (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)
  1127.         {
  1128.             _JPGBreak();
  1129.             jpg_break_up_down = 0x20;   //Maoyong 2004.04.19, down break preview flag
  1130.             FSGUI_FillFrameBuf(Rect[ PREVIEW_RECT].xStart, Rect[ PREVIEW_RECT].yStart,
  1131.                            Rect[ PREVIEW_RECT].xSize,  Rect[ PREVIEW_RECT].ySize,
  1132.                            PREVIEW_BKGROUND_Y, PREVIEW_BKGROUND_CRCB);
  1133.         }
  1134. #endif
  1135.     } else if (pFsJpeg->ControlArea == CNT_AREA_DIR) {
  1136.         if (pFsJpeg->fsnav_dir_will < (pFsJpeg->fsnav_dir_cnt - 1))
  1137.         {
  1138.             pFsJpeg->fsnav_dir_will++;
  1139.             FSGUI_PreFindDir(&(pFsJpeg->fsnav_dir_will), 0); //panxing for yuxing,2002-4-11
  1140.             CalcDirNow(&(pFsJpeg->fsnav_dir_will));
  1141.             FSShowDirIcon();
  1142.             DirList();
  1143.         #ifdef FS_BMP_GUI
  1144.             if (pFsJpeg->dir_current % PER_PAGE == 0)
  1145.                 DIR_MoveScroll(pFsJpeg->dir_page_now);
  1146.         #endif
  1147. //wanghaoying 2004-8-4 21:27, maybe this block not need for MP3_LARGE_GUI
  1148.         #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  1149.             //when return to prev page,must show the current playing dir . zhaoyanhua 2004-6-30 10:14
  1150.             int  dir_index = antiAnchorDir(pFsJpeg->fsnav_dir_will);
  1151.             if ( dir_index == ((pFsJpeg->dir_page_now) * PER_PAGE))//pFsJpeg->dir_page_now
  1152.                 ShowCurrentDirPlaying();
  1153.         #endif//  #if defined (NEW_MP3_GUI) || defined (FS_MP3_GUI)
  1154.             sys_cmd = CMD_SELECT|CMD_FUNC_GAME_DN;
  1155.             iRes = 0x20000|sys_cmd;
  1156.             sys_cmd = 0;    // avoid receive another command,panxing,2002-4-13
  1157.         }
  1158.     }
  1159. #ifdef FS_BMP_GUI  //when control area is buttons, press down to move to files, add by feeling 2004-07-05
  1160. else  if (pFsJpeg->ControlArea >  CNT_AREA_DIR)
  1161. {
  1162. pFsJpeg->ControlArea = CNT_AREA_FILE;
  1163.         if (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)//zhaoyanhua  3-7-10 11:23
  1164.     {
  1165.     if (JPEG_Preview_drawed == JPEG_PREVIEW_IN_DIR_AREA)
  1166. {
  1167. JPEG_Preview_drawed = DIR_LIST_IN_DIR_AREA ;
  1168. }
  1169.         // to solve when UP to preview JPEG,restart. 3-7-24 16:51
  1170. pFsJpeg->gifsbPreview = 1;
  1171.     }
  1172. sys_cmd = CMD_SELECT|CMD_FUNC_GAME_DN;
  1173. iRes = 0x20000|sys_cmd;
  1174. sys_cmd = 0;    // avoid receive another command,panxing,2002-4-13
  1175. }
  1176. #endif
  1177.     else
  1178.     {
  1179.         iRes = 0;
  1180.         sys_cmd = 0;
  1181.     }
  1182. #if (defined (NEW_MP3_GUI) || defined (FS_BMP_GUI))&& !(defined (MP3_JPEG_COWORK))
  1183. //ycwen  2005/1/21 When MP3_JPEG_COWORK, ShowHL is needed when mp3/jpg long seek
  1184. //#if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  1185.     //avoid GUI blinking.zhaoyanhua 2004-2-2 16:25
  1186.     //reduce flash,when preview jpeg,suqiaoli add 2004-10-9     
  1187.     if( (pFsJpeg->gifsFuncBtn != FS_FUNC_JPEG)||(pFsJpeg->ControlArea == CNT_AREA_DIR))
  1188.      ShowHL();
  1189. #else
  1190.     SelectHL();
  1191. #endif
  1192.     return iRes;
  1193. }
  1194. UINT32  FSGUI_CmdUp()
  1195. {
  1196.     UINT32  iRes=0;
  1197. #ifdef  MP3_JPEG_COWORK
  1198.         old_time=get_stc_32_inline();//get the press time
  1199. #endif
  1200.     if (pFsJpeg->gifsState == FS_STATE_JPEG)
  1201. {//terry,2004/1/30 06:38PM
  1202. #ifdef JPG_EFFECT
  1203.         sys_cmd = (CMD_SELECT | CMD_FUNC_GAME_UL);
  1204. #else
  1205.         sys_cmd = iRes;
  1206. #endif
  1207.         return sys_cmd;
  1208.     }
  1209.     if ((pFsJpeg->ControlArea == CNT_AREA_FILE)) {
  1210.         // Now in File area, panxing, 2002-1-29
  1211.         if (pFsJpeg->file_will > 0)
  1212.         {
  1213.             // needn't change file page, panxing, 2002-4-15
  1214.             (pFsJpeg->file_will)--;
  1215.             pFsJpeg->fsnav_trk_will = pFsJpeg->file_array[pFsJpeg->file_will] - pFsJpeg->first_mp3_entry;
  1216.         }
  1217.         else
  1218.         {
  1219.             // change file page now, panxing, 2002-4-15
  1220.             if (pFsJpeg->file_page_will)
  1221.             {
  1222.                 pFsJpeg->file_page_will--;
  1223.                 PrepareForChangeFilePage(pFsJpeg->file_page_will, 0, 1);
  1224.                 ShowFileIcon();
  1225.                 FileList();
  1226. #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  1227.                 ShowCurrentFilePlaying();//If refresh page,must redraw the current file playing.zhaoyanhua add 2004-2-3 9:09
  1228.     #ifdef FS_BMP_GUI
  1229.                 MoveScroll(pFsJpeg->file_page_will);
  1230.     #endif
  1231. #endif
  1232.             }
  1233. #ifdef FS_BMP_GUI
  1234.     else//when control area is the first file in the file list, press up to move to the correspond button, add by feeling 2004-07-05
  1235.     {
  1236.       pFsJpeg->ControlArea = pFsJpeg->gifsFuncBtn +1;//CNT_AREA_MP3BUTTON;
  1237.     }
  1238. #endif
  1239. #ifdef FSGUI_NO_BLINK_SCROLL
  1240. else
  1241. {
  1242. invalid_key();
  1243. sys_cmd = iRes;
  1244. return iRes;
  1245. }
  1246. #endif
  1247.         }
  1248. #ifdef MP3_LARGE_GUI
  1249.         if ((pFsJpeg->gifsState == FS_STATE_LIST) && (pFsJpeg->gifsFuncBtn != FS_FUNC_MP3))
  1250.         {
  1251.             Will2Playing();
  1252.             pFsJpeg->gifsbPreview = 1;
  1253.         }
  1254.         MoveScroll(pFsJpeg->file_page_will * PER_PAGE + pFsJpeg->file_will);
  1255.         sys_cmd = CMD_SELECT|CMD_FUNC_GAME_UL;
  1256. #else
  1257.         FSGUI_FileAreaUpdownRefresh();
  1258.         sys_cmd = CMD_SELECT|CMD_FUNC_GAME_DN;
  1259. #endif
  1260.         iRes = 0x20000|sys_cmd;
  1261.         sys_cmd = 0;        //avoid to receive another sys_cmd when out mainloop,panxing,2002-4-13
  1262.         //Jeff 20020509
  1263.         if (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)
  1264.         {
  1265.             //suqiaoli delete old part here,in order to show correctly Jpeg dir.
  1266.             _JPGBreak();
  1267. #ifdef MP3_LARGE_GUI
  1268. jpg_break_up_down = 0x10;
  1269. #else
  1270.             jpg_break_up_down = 1;    //Maoyong 2004.05.19
  1271. #endif
  1272. //Maoyong 2004.05.31,when IR up/down, should clear current preview picture
  1273. #ifdef NEW_MP3_GUI
  1274.             FSGUI_FillFrameBuf(Rect[ PREVIEW_RECT].xStart, Rect[ PREVIEW_RECT].yStart,
  1275.                            Rect[ PREVIEW_RECT].xSize,  Rect[ PREVIEW_RECT].ySize,
  1276.                            PREVIEW_BKGROUND_Y, PREVIEW_BKGROUND_CRCB);
  1277. #elif !defined (FS_BMP_GUI)
  1278.             ClearArea(FS_AREA_PREVIEWJPG);
  1279. #endif
  1280.         }//end   if (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)
  1281.     } //end  if ((pFsJpeg->ControlArea == CNT_AREA_FILE))
  1282.     else if (pFsJpeg->ControlArea == CNT_AREA_DIR) {
  1283. #ifdef FS_BMP_GUI //when control area is the first dir in the dir list, press up to move to the correspond button, add by feeling 2004-07-05
  1284. if  ( (pFsJpeg->dir_current == 0) && (pFsJpeg->dir_page_now == 0))
  1285.     {
  1286.     pFsJpeg->ControlArea = pFsJpeg->gifsFuncBtn +1;//CNT_AREA_MP3BUTTON;
  1287. sys_cmd = CMD_SELECT|CMD_FUNC_GAME_UL;
  1288. iRes = 0x20000 | sys_cmd;
  1289.         sys_cmd = 0;
  1290.     }
  1291. else
  1292. #endif
  1293.         // Now in dir area, panxing, 2002-1-22
  1294.         if (pFsJpeg->fsnav_dir_will)
  1295.         {
  1296.             pFsJpeg->fsnav_dir_will--;
  1297.             FSGUI_PreFindDir(&(pFsJpeg->fsnav_dir_will), 1); //panxing for yuxing,2002-4-11
  1298.             CalcDirNow(&(pFsJpeg->fsnav_dir_will));
  1299.             FSShowDirIcon();
  1300.             DirList();
  1301.         #ifdef FS_BMP_GUI
  1302.             if (pFsJpeg->dir_current % PER_PAGE == PER_PAGE - 1)
  1303.                 DIR_MoveScroll(pFsJpeg->dir_page_now);
  1304.         #endif
  1305. //wanghaoying 2004-8-4 21:27, maybe this block not need for MP3_LARGE_GUI
  1306.         #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  1307.             //when return to prev page,must show the current playing dir . zhaoyanhua 2004-6-30 10:14
  1308.             int  dir_index = antiAnchorDir(pFsJpeg->fsnav_dir_will);
  1309.             if ( dir_index == ((pFsJpeg->dir_page_now+1) * PER_PAGE - 1))//pFsJpeg->dir_page_now
  1310.                 ShowCurrentDirPlaying();
  1311.         #endif// #if defined (NEW_MP3_GUI) || defined (FS_MP3_GUI)
  1312.             sys_cmd = CMD_SELECT|CMD_FUNC_GAME_UL;
  1313.             iRes = 0x20000|sys_cmd;
  1314.             sys_cmd = 0;    //avoid to receive another commmand when timeout mainloop,panxing,2002-4-13
  1315.         }//end if (pFsJpeg->fsnav_dir_will)
  1316.     } //end if (pFsJpeg->ControlArea == CNT_AREA_DIR)
  1317. #ifdef FS_BMP_GUI //when control area is button,when press up to reture invalid key, by feeling 2004-07-05
  1318. else
  1319. {
  1320. invalid_key();
  1321. sys_cmd = iRes;
  1322. return iRes;
  1323.         }
  1324. #else
  1325.     else
  1326.     {
  1327.         // Now in control button area, panxing, 2002-1-22
  1328.         pFsJpeg->ControlArea = CNT_AREA_FILE;
  1329.         iRes = 0x20000 | sys_cmd;
  1330.         sys_cmd = 0;
  1331. #if defined (NEW_MP3_GUI) //|| defined (FS_BMP_GUI)
  1332.         if (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)//zhaoyanhua  3-7-10 11:23
  1333.         {
  1334.             if (JPEG_Preview_drawed == JPEG_PREVIEW_IN_DIR_AREA)
  1335.             {
  1336.                 JPEG_Preview_drawed = DIR_LIST_IN_DIR_AREA ;
  1337.             }
  1338.             // to solve when UP to preview JPEG,restart. 3-7-24 16:51
  1339.             pFsJpeg->gifsbPreview = 1;
  1340.         }
  1341. #endif//end #if defined (NEW_MP3_GUI) //|| defined (FS_BMP_GUI)
  1342.     }
  1343. #endif//end #ifdef FS_BMP_GUI
  1344. #if (defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)) && !(defined (MP3_JPEG_COWORK)) //ycwen
  1345. //ycwen : 2005/1/21 When MP3_JPEG_COWORK, ShowHL is needed when mp3/jpg long seek    
  1346. //#if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  1347.     //avoid GUI blinking.zhaoyanhua 2004-2-2 16:25
  1348.     //reduce flash,when preview jpeg,suqiaoli add 2004-10-9 
  1349.     //if( (pFsJpeg->gifsFuncBtn != FS_FUNC_JPEG)||(pFsJpeg->ControlArea == CNT_AREA_DIR))
  1350.     if(!( (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)&&(pFsJpeg->ControlArea == CNT_AREA_FILE)))
  1351.     //replace by liudan,to avoid when up from first jpg dir to jpbbutton the key is invalid,2004-11-6 9:28
  1352.     ShowHL();
  1353. #else
  1354. SelectHL();
  1355. #endif
  1356.     return iRes;
  1357. }
  1358. UINT32 FSGUI_CmdEnter()
  1359. {
  1360.     UINT32  iRes=0;
  1361.     BYTE    bSorb=1;
  1362. #ifdef RECORD_PER_SECOND        //avoid bug when playing mp3  gerry  2-12-3 19:46
  1363.     resumeMSF = 0;
  1364. #endif
  1365. #ifdef MP3_TXT_DISPLAY //zhaoyanhua add 2003-9-2 16:06
  1366.     if ((MP3_Lyrics_Drawed == MP3_LYRICS_IN_DIR_AREA) && (pFsJpeg->ControlArea != CNT_AREA_FILE))
  1367.     {
  1368.         MP3_Lyrics_Drawed = DIR_LIST_IN_DIR_AREA;
  1369.         DrawRectCorner(Rect[DIR_RECT], CORNER_RAD, 1, 40, DIR_AREA_BKGROUND_CRCB);
  1370.     }
  1371. #endif
  1372. #ifdef JPG_EFFECT
  1373.     jpeg_effect_init();
  1374. #endif
  1375.     if (pFsJpeg->ControlArea == CNT_AREA_FILE)
  1376.     {
  1377.         if (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)
  1378.         {
  1379. #ifdef MENU_STOP_EXCHANGE
  1380.             pFsJpeg->g_nJpegMode=JPEG_THUMBNAIL_MODE;       //xulf 2003-12-6
  1381. #endif
  1382.             pFsJpeg->gifsState = FS_STATE_JPEG;
  1383. #if defined (NEW_MP3_GUI) || defined (FS_BMP_GUI)
  1384.             osd_tog_region(1, OSD_OFF);     //Maoyong 2004.03.11, When show "STOP", enter should make osd disappear
  1385. #endif
  1386.         }
  1387.         else if (pFsJpeg->gifsFuncBtn == FS_FUNC_MP3)
  1388.         {
  1389.             pFsJpeg->gifsState = FS_STATE_MP3;
  1390.             Will2Playing();
  1391.         }
  1392. #if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
  1393.         else if (pFsJpeg->gifsFuncBtn == FS_FUNC_GAME)
  1394.         {
  1395.             pFsJpeg->gifsState = FS_STATE_GAME;
  1396.         }
  1397. #endif
  1398. #ifdef SUPPORT_FILE_SYSTEM_MODE // Robert 021001    2004/01/07 yltseng
  1399.         else if (pFsJpeg->gifsFuncBtn == FS_FUNC_OTHER)
  1400.         {
  1401.             pFsJpeg->gifsState = FS_STATE_OTHER;
  1402.             Will2Playing();
  1403.         }
  1404. #endif
  1405. #ifdef SUPPORT_MIDI
  1406.         else if (pFsJpeg->gifsFuncBtn == FS_FUNC_MIDI)
  1407.         {
  1408.             pFsJpeg->gifsState = FS_STATE_MIDI;
  1409.             Will2Playing();
  1410.         }
  1411. #endif
  1412. #if defined ( NEW_MP3_GUI) || defined ( FS_BMP_GUI)
  1413. #ifdef NEW_MP3_GUI
  1414.         ClearRectArea(Rect[FILE_RECT], FILE_STEP, FILE_AREA_BKGROUND_CRCB,FS_AREA_FILEITEM, fsnav_file_HL);
  1415.     #else
  1416.         FSGUI_ClearArea(FS_AREA_FILEITEM, fsnav_file_HL);
  1417.         ShowFileIcon();//avoid disppearing file icon,suqiaoli add 2004-10-9
  1418.     #endif
  1419.         FSShowFileItem(fsnav_file_HL, iso9660_file[pFsJpeg->file_array[fsnav_file_HL]].name);//resume the last HL
  1420. #endif
  1421.         sys_cmd = CMD_FUNC | CMD_FUNC_SELECT;
  1422.         iRes = sys_cmd;
  1423.         bSorb = 0;
  1424.     }
  1425.     else if (pFsJpeg->ControlArea == CNT_AREA_DIR)
  1426.     {
  1427.         pFsJpeg->fsnav_dir_now = pFsJpeg->fsnav_dir_will;
  1428.         FSGUI_PreChangeDir(&(pFsJpeg->fsnav_dir_now), 0);
  1429.         sys_cmd = CMD_FUNC | CMD_FUNC_SELECT;
  1430.         iRes = sys_cmd;
  1431.         bSorb = 0;
  1432.     #if !defined (FS_BMP_GUI)//zhaoyanhua add 2004-6-14 14:20
  1433.         refresh_dir_icon = 1;
  1434.     #endif//ifndef FS_BMP_GUI
  1435. #if defined ( NEW_MP3_GUI ) || defined ( FS_BMP_GUI )
  1436.         if (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG)//when change to DIR area, must refresh.zhaoyanhua note 3-7-10 11:12
  1437.             refresh_dir_page = 1;
  1438.     #ifdef  NEW_MP3_GUI
  1439.         ClearRectArea(Rect[DIR_RECT], DIR_STEP, DIR_AREA_BKGROUND_CRCB, FS_AREA_DIRITEM, fsnav_dir_HL);
  1440.     #else
  1441.         FSGUI_ClearArea(FS_AREA_DIRITEM, fsnav_dir_HL);
  1442.     #endif
  1443.         //clear the last HL DirItem.
  1444.     #ifdef  NEW_MP3_GUI
  1445.         ClearRectArea(Rect[DIR_RECT], DIR_STEP, DIR_AREA_BKGROUND_CRCB, FS_AREA_DIRITEM, fsnav_dir_HL);
  1446.     #endif
  1447.         ShowDirItem(fsnav_dir_HL, iso9660_dir[pFsJpeg->dir_array[fsnav_dir_HL]].name);//resume the last HL
  1448.         FSGUI_Refresh();
  1449. #endif//#if defined ( NEW_MP3_GUI ) || defined ( FS_BMP_GUI )
  1450. #ifdef HANYANG_LR_CHANGE_PAGE
  1451.         //When enter in DIR area, right to file area
  1452.         FSGUI_Dir2FileArea();
  1453. #endif
  1454.     }
  1455.     else
  1456.     {
  1457.         // Now in button area, panxing, 2002-1-22
  1458.         int iChange = 0;
  1459. #ifdef SETUP_PROGRAM_IN_PLACE_UNDER_16M
  1460.         // 2004/11/26 yltseng, When exit mp3 tab, pFsJpeg->gifsState will update to FS_STATE_LIST
  1461.         // only after leave MediaMainLoop; But during this little period of time, if we use this
  1462.         // variable to do something, we may get wrong data. So I update this variable here.
  1463.         pFsJpeg->gifsState = FS_STATE_LIST; 
  1464. #endif
  1465.         
  1466. #ifdef FS_BMP_GUI
  1467.     //press enter to clear the down button
  1468.     //if hl is on the down button, the down button would not be changed,add by feeling 2004-07-05
  1469. if (pFsJpeg->ControlArea != pFsJpeg->gifsFuncBtn +1)
  1470.     FSGUI_DrawOneButton(pFsJpeg->gifsFuncBtn,UP_STATE);
  1471. #endif
  1472.         if ((pFsJpeg->ControlArea == CNT_AREA_MP3BUTTON) && (pFsJpeg->gifsFuncBtn != FS_FUNC_MP3))
  1473.         {
  1474.             //Maoyong 2004.05.31 when preview JPEG, enter the MP3 , must redraw the background.
  1475.             if( (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG) && (pFsJpeg->gifsState == FS_STATE_LIST) )
  1476.                 ClearJpegPreviewBg();
  1477. #ifdef  MP3_JPEG_COWORK
  1478.          back_sign=1;
  1479.          pFsJpeg->gifsFuncBtn=FS_FUNC_MP3;
  1480. #else
  1481.             FSNav_MP3Init();
  1482. #endif
  1483.             iChange = 1;
  1484.         }
  1485.         else if ((pFsJpeg->ControlArea == CNT_AREA_JPEGBUTTON) && (pFsJpeg->gifsFuncBtn != FS_FUNC_JPEG))
  1486.         {
  1487. #ifdef IR_PROG_ON//nono 4-1-12 17:08
  1488.             if(prog_cnt)
  1489.             {
  1490.             prog_cnt = 0;
  1491.             PrintOsdMsg(STR_OS_PROG_CNL,REGION1,1,0);
  1492.             }
  1493. #endif//#ifdef IR_PROG_ON
  1494. #ifdef FSGUI_NO_BLINK_SCROLL
  1495. up_down_done=0;
  1496. #endif
  1497. #if defined ( NEW_MP3_GUI) || defined ( FS_BMP_GUI)
  1498.             refresh_dir_page = 1;   //Maoyong 2004.05.19
  1499. #endif
  1500.             FSNav_JPEGInit();
  1501. #ifdef JPG_EFFECT
  1502.             Jpg_Show_Usage_Page=0;
  1503.             Jpg_Show_Usage_Flag=0;
  1504. #endif
  1505. #if defined(IR_KODAK_EFFECT_KEY_USE_DISPLAY)//nono 20031122
  1506.             if (t_disp)
  1507. {
  1508.         DispFadeOut();
  1509.         disp_mode=0;
  1510. }
  1511. #endif//defined(IR_KODAK_EFFECT_KEY_USE_DISPLAY)
  1512.             iChange = 1;
  1513.         }
  1514. #if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
  1515.         else if ((pFsJpeg->ControlArea == CNT_AREA_GAMEBUTTON) && (pFsJpeg->gifsFuncBtn != FS_FUNC_GAME))
  1516.         {
  1517. #ifdef IR_PROG_ON//nono 4-1-12 17:08
  1518.             if(prog_cnt)
  1519.             {
  1520.             prog_cnt = 0;
  1521.             PrintOsdMsg(STR_OS_PROG_CNL,REGION1,1,0);
  1522.             }
  1523. #endif//#ifdef IR_PROG_ON
  1524. /* nes driver is put into ROM, Robert 03/04/29
  1525.             if (pFsJpeg->gifsNESDrvSize > 0)
  1526. */
  1527.             {
  1528.                 AVD_SetMediaTimeout();
  1529.                 iChange = 0;
  1530.                 refresh_dir_page = 1;
  1531.                 //Maoyong 2004.05.31 when preview JPEG, enter the MP3 , must redraw the background.
  1532.                 if( (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG) && (pFsJpeg->gifsState == FS_STATE_LIST) )
  1533.                     ClearJpegPreviewBg();
  1534. #if defined(SUPPORT_NESGAME)||defined(SUPPORT_SPG_GAME)
  1535.                 extern void FSNav_GameInit();
  1536.                 FSNav_GameInit();
  1537. #endif                
  1538. #ifdef FS_BMP_GUI
  1539.         FSGUI_ShowBtnTitle();//feeling 2004-07-29
  1540. #endif
  1541.                 sys_cmd = CMD_FUNC | CMD_FUNC_SELECT;
  1542.                 iRes = 0x20000 | sys_cmd;
  1543.                 return iRes;
  1544.             }
  1545.         }
  1546. #endif
  1547. #ifdef SUPPORT_FILE_SYSTEM_MODE // Robert 021001
  1548.         else if ((pFsJpeg->ControlArea == CNT_AREA_OTHERBUTTON) && (pFsJpeg->gifsFuncBtn != FS_FUNC_OTHER))
  1549.         {
  1550. //wanghaoying changed, 2004-5-13 9:15
  1551. #if defined(IR_PROG_ON)&&defined(NEW_MP3_GUI)//nono 4-1-12 17:08
  1552.             if(prog_cnt)
  1553.             {
  1554.              prog_cnt = 0;
  1555.              PrintOsdMsg(STR_OS_PROG_CNL,REGION1,1,0);
  1556.             }
  1557. #endif//#ifdef IR_PROG_ON
  1558.             //Maoyong 2004.05.31 when preview JPEG, enter the MP3 , must redraw the background.
  1559.             if( (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG) && (pFsJpeg->gifsState == FS_STATE_LIST) )
  1560.                 ClearJpegPreviewBg();
  1561. //yanlb 2004.08.09 when support id3,preview MP3, enter the Other , must clear id3 region.
  1562. #ifdef SUPPORT_OSDID3
  1563. if(Is_MP3_STATE()){
  1564. osd_tog_region(REGION3, OSD_OFF);
  1565.      }
  1566. #endif
  1567. #if defined(NEW_MP3_GUI) || defined (FS_BMP_GUI)//zhaoyanhua add 2004-6-15 13:57
  1568.              refresh_dir_page = 1;
  1569. #endif
  1570.             FSNav_OtherInit();
  1571.             iChange = 1;
  1572.         }
  1573. #endif
  1574. #ifdef SUPPORT_MIDI
  1575.         else if ((pFsJpeg->ControlArea == CNT_AREA_MIDIBUTTON) && (pFsJpeg->gifsFuncBtn != FS_FUNC_MIDI))
  1576.         {
  1577.             MidiCreate();
  1578.             iChange = 1;
  1579.         }
  1580. #endif
  1581.         if(iChange)
  1582.         {
  1583. #if !(defined(NEW_MP3_GUI) || defined (FS_BMP_GUI))
  1584.             ClearArea(FS_AREA_PREVIEWJPG);
  1585. #endif
  1586.             #ifdef DISPLAY_FBWARD_OSD //Maoyong added 2004-8-13 23:56
  1587.     if( (RegionOnOff[1][2]==STR_OS_FF)||(RegionOnOff[1][2]==STR_OS_FB) ) {
  1588.         timeout_osd[1]=1;//nono 2003-8-11 22:51
  1589.                 adv_search_time = 0;
  1590.             }
  1591.             #endif//DISPLAY_FBWARD_OSD
  1592.             refresh_dir_page = 1;
  1593.             sys_cmd = CMD_FUNC | CMD_FUNC_SELECT;
  1594.             iRes = sys_cmd;
  1595.             bSorb = 0;
  1596.         }
  1597.         #ifdef HANYANG_LR_CHANGE_PAGE
  1598.         //after selecting button, change to dir area
  1599.         FSGUI_File2DirArea();
  1600.         #endif
  1601.     }
  1602.     if (bSorb == 1)
  1603.     {
  1604.         sys_cmd = 0;
  1605.         iRes=0;
  1606.     }
  1607. #ifdef FS_BMP_GUI
  1608. if (pFsJpeg->ControlArea >= CNT_AREA_MP3BUTTON)
  1609. FSGUI_ShowBtnTitle();
  1610. #endif
  1611.     return iRes;
  1612. }
  1613. #ifdef MP3_TXT_DISPLAY
  1614. #define LYRECT_XSIZE      145
  1615. #define LYRECT_XSTART     25
  1616. void ClearLycArea(BTNAREA  Rect, UINT16 RectColorStep,UINT16 RegionColor_C,int ItemStart, int ItemNumber)
  1617. {
  1618.     int i =0;
  1619.     int  x0=0,y0=0;
  1620.     UINT8 RegionColor_Y[60];
  1621.     int Region[60];
  1622.     UINT8 StepCount =0;
  1623.     int  xAreaStart=0,yAreaStart = 0, xAreaSize=0,yAreaSize=0;
  1624.     // calulate the Y and Region width according to the given step.
  1625.     for ( i = 0; i < RectColorStep; i++ )
  1626.     {
  1627.         Region[i] = Rect.xStart + i*(Rect.xSize / RectColorStep);
  1628.         RegionColor_Y[i] = 0x36 + i*((0xc1 - 0x36)/RectColorStep);
  1629.     }
  1630.     xAreaStart = LYRECT_XSTART;
  1631.     yAreaStart = FS_DIRLIST_YSTART + ItemStart *FS_FILELIST_YSTEP;
  1632.     xAreaSize =  LYRECT_XSIZE ;
  1633.     yAreaSize =  ItemNumber*FS_FILELIST_YSTEP;
  1634.     StepCount = 0;
  1635.     //printf("Region[ 1 ] = %dn",Region[1]);
  1636.     while(xAreaStart >= Region[StepCount])
  1637.     {
  1638.         StepCount++;
  1639.     }
  1640.     StepCount = StepCount-1;
  1641.     //printf("xAreaStart=%d,Region[%d]=%dn",xAreaStart,StepCount,Region[StepCount]);
  1642.     for (x0 = xAreaStart; x0 < (xAreaStart+ xAreaSize); x0++)
  1643.     {
  1644.         if((StepCount +1) < RectColorStep)
  1645.         {
  1646.             if ((x0 >= Region[StepCount]) && (x0 < Region[StepCount + 1]))
  1647.             {
  1648.                 StepCount++;
  1649.             }
  1650.         }
  1651.         else
  1652.             StepCount = RectColorStep -1;
  1653.         for (y0 = yAreaStart; y0 < (yAreaStart+yAreaSize); y0++)
  1654.         {
  1655.             *Y_XY((x0),(y0)) = RegionColor_Y[StepCount];
  1656.             *C_XY((x0),(y0)) = RegionColor_C;
  1657.         }
  1658.     }
  1659. }
  1660. #endif //#ifdef MP3_TXT_DISPLAY
  1661. #if !defined(NEW_MP3_GUI)
  1662. void ClearArea(UINT16 iIndex)
  1663. {
  1664. #ifdef AUDIO_SHOW_SAVER
  1665.     if (bDisableGUI) return;
  1666. #endif
  1667. if ((pFsJpeg->gifsState == FS_STATE_JPEG) && (pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG))
  1668. return;
  1669. if ((iIndex == FS_AREA_FILEICON) && (refresh_file_page==0))
  1670. {
  1671. // need clear current file icon
  1672. FSGUI_FillFrameBuf(fsArea[iIndex].xStart,
  1673. fsArea[iIndex].yStart + pFsJpeg->file_current * FS_FILELIST_YSTEP,
  1674. fsArea[iIndex].xSize, fsArea[iIndex].ySize,
  1675. BK_GROUNDY, BK_GROUNDCRCB);
  1676. }
  1677. else if ((iIndex == FS_AREA_FILEICON) && (refresh_file_page == 1))
  1678. {
  1679. // clear all file icon
  1680. FSGUI_FillFrameBuf(fsArea[iIndex].xStart, fsArea[iIndex].yStart,
  1681. fsArea[iIndex].xSize, PER_PAGE * FS_FILELIST_YSTEP,
  1682. BK_GROUNDY, BK_GROUNDCRCB);
  1683. }
  1684. else
  1685. {
  1686. // FSGUI_FillFrameBuf(fsArea[iIndex].xStart, fsArea[iIndex].yStart,
  1687. FSGUI_FillFrameBuf(fsArea[iIndex].xStart - 2, fsArea[iIndex].yStart, // Robert 030506 for file area UI issue
  1688. fsArea[iIndex].xSize, fsArea[iIndex].ySize,
  1689. BK_GROUNDY, BK_GROUNDCRCB);
  1690. }
  1691. }
  1692. #endif // if !defined(NEW_MP3_GUI)
  1693. #ifdef NEW_MP3_GUI
  1694. /*
  1695.  * FUNC : Clear the item in Rectangle with four corner.
  1696.  * NOTE:  Rectangle dipslay with varient colors, so when clear the item
  1697.  *        must use the same varient colors.
  1698.  * INPUT:
  1699.  *        RgionIndex: FILE/DIR/PATH
  1700.  *        RectColorStep: to calculate the same varient color  as Rectangle.
  1701.  *
  1702.  *        iIndex :   Area index.
  1703.  *        iItem  :   if iItem >=0, it means that only clear item (file,dir) not clear the whole Area.
  1704.  * Creator: zhaoyanhua
  1705.  * Date: 3-6-30 19:47
  1706.  */
  1707. void ClearRectArea(BTNAREA  Rect, UINT16 RectColorStep,UINT16 RegionColor_C,int iIndex,int iItem)
  1708. {
  1709.     //int i =0;
  1710.     int  x0=0,y0=0;
  1711.     //UINT8 RegionColor_Y[60];
  1712.     //int Region[60];
  1713.     UINT16  RegionStep = 0;
  1714.     UINT8   RegionColorStep_Y = 0;
  1715.     UINT8 StepCount =0;
  1716.     int  xAreaStart=0,yAreaStart = 0, xAreaSize=0,yAreaSize=0;
  1717.     // calulate the Y and Region width according to the given step.
  1718. #if 0
  1719.     for ( i = 0; i < RectColorStep; i++ )
  1720.     {
  1721.         Region[i] = Rect.xStart + i*(Rect.xSize / RectColorStep);
  1722.         RegionColor_Y[i] = 0x36 + i*((0xc1 - 0x36)/RectColorStep);
  1723.         //printf("Region[%d] = %d,REgionColor_Y[i] = %dn",i,Region[i],RegionColor_Y[i]);
  1724.     }
  1725.     #endif
  1726. RegionStep = Rect.xSize / RectColorStep;
  1727.     RegionColorStep_Y = (0xc1-0x36) / RectColorStep;
  1728. #ifdef MONO_FSGUI //mono FS GUI, axel 2003-12-29 23:26
  1729. RectColorStep=1;
  1730.     RegionColorStep_Y=PREVIEW_BKGROUND_Y;
  1731. #endif
  1732.     if ((iIndex == FS_AREA_FILEICON) && (refresh_file_page==0))
  1733.     {
  1734.         // need clear current file icon
  1735.         xAreaStart = fsArea[iIndex].xStart;
  1736.         yAreaStart = fsArea[iIndex].yStart + pFsJpeg->file_current * FS_FILELIST_YSTEP;
  1737.         xAreaSize = fsArea[iIndex].xSize;
  1738.         yAreaSize = fsArea[iIndex].ySize;
  1739.     }
  1740.     else if ((iIndex == FS_AREA_FILEICON) && (refresh_file_page == 1))
  1741.     {
  1742.         // clear all file icon
  1743.         xAreaStart = fsArea[iIndex].xStart;
  1744.         yAreaStart = fsArea[iIndex].yStart;
  1745.         xAreaSize = fsArea[iIndex].xSize;
  1746.         yAreaSize = PER_PAGE * FS_FILELIST_YSTEP;
  1747.     }
  1748.     else if (iItem >= 0) //for clear last FILE or DIR item when show Current playing.
  1749.     {
  1750.         xAreaStart = fsArea[iIndex].xStart - 2;
  1751.         yAreaStart = FS_DIRLIST_YSTART - DEMENSION_SIZE + iItem * FS_FILELIST_YSTEP;
  1752.         xAreaSize =  ITEM_MAX_WIDTH;//clear width;
  1753.         yAreaSize = FS_FILELIST_YSTEP;
  1754.     }
  1755.     else
  1756.     {
  1757.         xAreaStart = fsArea[iIndex].xStart -2;
  1758.         yAreaStart = fsArea[iIndex].yStart;
  1759.         xAreaSize = fsArea[iIndex].xSize;
  1760.         yAreaSize = fsArea[iIndex].ySize;
  1761.     }
  1762.     StepCount = 0;
  1763.     while(xAreaStart >= (Rect.xStart + RegionStep * StepCount))
  1764.     {
  1765.         StepCount++;
  1766.     }
  1767.     StepCount = StepCount-1;
  1768.     for (x0 = xAreaStart; x0 < (xAreaStart+ xAreaSize); x0++)
  1769.     {
  1770.         if((StepCount +1) < RectColorStep)
  1771.         {
  1772.             if ((x0 >= (Rect.xStart + RegionStep * StepCount)) && (x0 < (Rect.xStart + RegionStep * (StepCount+1))))
  1773.             {
  1774.                 StepCount++;
  1775.             }
  1776.         }
  1777.         else
  1778.             StepCount = RectColorStep -1;
  1779.         for (y0 = yAreaStart; y0 < (yAreaStart+yAreaSize); y0++)
  1780.         {
  1781.             *Y_XY((x0),(y0)) = 0x36+RegionColorStep_Y*StepCount;//RegionColor_Y[StepCount];
  1782.             *C_XY((x0),(y0)) = RegionColor_C;
  1783.         }
  1784.     }
  1785. }
  1786. /*                                                                                                                                                       Date   : 3-6-30 17:10
  1787.  *  FUNC: Draw a rectangle with 4 circle corner,
  1788.  *        which is filled with varient colors.
  1789.  *
  1790.  *  NOTE:
  1791.  *      1) if draw  a rectangle neither UP nor DOWN, the function
  1792.  *         will auto set the frame line color to be white .
  1793.  *      2) MAX_STEP is the max steps that the function can show.
  1794.  *
  1795.  *  INPUT:
  1796.  *   CornerRad:       the corner radius
  1797.  *   step:            use to calculate a varient color.
  1798.  *                    if step = 0, only fill with default luminance value.
  1799.  *   RegionColor_C :  the base Chrominance of varient fill colors
  1800.  *
  1801.  *  zhaoyanhua
  1802.  *  Date:3-6-27 21:04
  1803.  */
  1804. void DrawRectCorner( BTNAREA  Rect, int CornerRad,  BYTE updown, UINT8 step, UINT16 RegionColor_C)
  1805. {
  1806.     int  CornerType = 0;
  1807.     //Note :
  1808.     //      "i" "j"  to find the correct pixel value in the array Corner[i][j]
  1809.     //    "x0" "y0" is the real position of one pixel in the framebuf.
  1810.     //       To a array Corner[i][j], "i" adds in vertical while "j" add in horizonal.
  1811.     //     In display, "y0" adds in vertical while "x0" adds in "horizonal".
  1812.     //
  1813.     //
  1814.     int  i=0,j=0;
  1815.     int  x0=0,y0=0;
  1816.     UINT8  RegionColor_Y[MAX_STEP];
  1817.     UINT16 Region[MAX_STEP];
  1818.     UINT8 StepCount =0;
  1819.     // to draw up or down.
  1820.     UINT16 LTColor_Y = 0,LTColor_CRCB = 0;//left ,top line use this color.
  1821.     UINT16 RBColor_Y = 0,RBColor_CRCB = 0;//right,bottom line use this color.
  1822.     int xStart=0,yStart=0,xLen =0,yLen=0;
  1823.     xStart = Rect.xStart;
  1824.     yStart = Rect.yStart;
  1825.     xLen = Rect.xSize;
  1826.     yLen = Rect.ySize;
  1827.     if (step)
  1828.     {
  1829.     // calulate the Y and Region width according to the given step.
  1830. #ifdef MONO_FSGUI //mono FS GUI, axel 2003-12-29 23:26
  1831. Region[0] = xLen;
  1832.         RegionColor_Y[0] = 0x36;//PREVIEW_BKGROUND_Y;
  1833. #else
  1834.         for (i = 0; i < step; i++ )
  1835.         {
  1836.             Region[i] = i*(xLen / step);
  1837.             RegionColor_Y[i] = 0x36 + i*((0xc1 - 0x36)/step);
  1838.         }
  1839. #endif
  1840.     }
  1841.     else //not draw step color. main for PREVIEW.
  1842.     {
  1843.         Region[0] = xLen;
  1844.         RegionColor_Y[0] = PREVIEW_BKGROUND_Y;
  1845.     }
  1846.     //calculate frame color according to the updown.
  1847.     if (updown == 1)//down
  1848.     {
  1849.         LTColor_Y = BLACK_Y;
  1850.         LTColor_CRCB = BLACK_CRCB;
  1851.         RBColor_Y = WHITE_Y;
  1852.         RBColor_CRCB= WHITE_CRCB;
  1853.     }
  1854.     else if(updown == 2)//up
  1855.     {
  1856.         LTColor_Y = WHITE_Y;
  1857.         LTColor_CRCB = WHITE_CRCB;
  1858.         RBColor_Y = BLACK_Y;
  1859.         RBColor_CRCB = BLACK_CRCB;
  1860.     }
  1861.     else//neither up nor down ,draw frame with the given paremeter"color_Y,color_CRCB"
  1862.     {
  1863.         LTColor_Y = WHITE_Y;
  1864.         LTColor_CRCB = WHITE_CRCB;
  1865.         RBColor_Y = WHITE_Y;
  1866.         RBColor_CRCB = WHITE_CRCB;
  1867.     }
  1868.     // draw x-majored
  1869.     for (x0 = 0; x0 < xLen; x0++)
  1870.     {
  1871.         // decide step-count
  1872.         if (step)
  1873.         {
  1874.             if((StepCount +1) < step)
  1875.         {
  1876.                 if ((x0 >= Region[StepCount]) && (x0 < Region[StepCount + 1]))
  1877.             {
  1878.                 StepCount++;
  1879.                 }
  1880.             }
  1881.         else
  1882.             StepCount = step -1;
  1883.         }
  1884.         else
  1885.             StepCount = 0;
  1886.         for (y0 = 0; y0 < yLen; y0++)
  1887.         {
  1888. #define DDD_TRANSPARENT 0
  1889. #define DDD_REGION      1
  1890. #define DDD_LT          2
  1891. #define DDD_RB          3
  1892.             int ccc = DDD_TRANSPARENT;
  1893.             if ((y0 >= 0) && (y0 < CornerRad) //Left Top
  1894.              && (x0 >= 0) && (x0 < CornerRad))
  1895.          {
  1896.                 CornerType = LT;
  1897.              i= y0;
  1898.              j= x0;
  1899.              if (CornerLT[i][j]==1)  ccc=DDD_LT;
  1900.                 else if (CornerLT[i][j]==2) ccc=DDD_REGION;
  1901.             }
  1902.          else if ((x0 >= ( xLen - CornerRad)) //Right_TOP
  1903.              && (x0 < xLen)
  1904.              && (y0 >= 0)
  1905.              && (y0 < CornerRad))
  1906.             {
  1907.              CornerType = RT;
  1908.              i = y0;
  1909.              j = x0 - (xLen - CornerRad);
  1910.              if (CornerRT[i][j]==1) ccc=DDD_RB;
  1911.              else if (CornerRT[i][j]==2) ccc=DDD_REGION;
  1912.              else if (CornerRT[i][j]==3) ccc=DDD_LT;
  1913.             }
  1914.          else if ((x0 >= 0)           //Left_Bottom
  1915.              && (x0 < ( CornerRad))
  1916.              && (y0 >= ( yLen - CornerRad))
  1917.              && (y0 < ( yLen)))
  1918.          {
  1919.              CornerType = LB;
  1920.              j = x0;
  1921.              i = y0 - (yLen - CornerRad);
  1922.              if (CornerLB[i][j]==1) ccc=DDD_LT;
  1923.                 else if (CornerLB[i][j]==2) ccc=DDD_REGION;
  1924.             }
  1925.          else if ((x0 >= ( xLen - CornerRad)) //Right_Bottom
  1926.                     && (x0 < ( xLen))
  1927.                     && (y0 >= ( yLen - CornerRad))
  1928.                     && (y0 < ( yLen)))
  1929.          {
  1930.              CornerType = RB;
  1931.              j = x0 - (xLen - CornerRad);
  1932.              i = y0 - (yLen - CornerRad);
  1933.              if (CornerRB[i][j]==1) ccc=DDD_RB;
  1934.                 else if (CornerRB[i][j]==2) ccc=DDD_REGION;
  1935.          }
  1936.          else
  1937.                 ccc = DDD_REGION;
  1938.             if (ccc!=DDD_TRANSPARENT)
  1939.             {
  1940.                 unsigned __y, __c;
  1941.                 switch (ccc) {
  1942.                 case DDD_LT:        __y=LTColor_Y; __c=LTColor_CRCB; break;
  1943.                 case DDD_RB:        __y=RBColor_Y; __c=RBColor_CRCB; break;
  1944.                 default:            __y=RegionColor_Y[StepCount];
  1945.                                     __c=RegionColor_C;
  1946.                 }
  1947.                 FSGUI_DrawPixel(xStart+x0, yStart+y0, __y, __c);
  1948.             }
  1949.         } //end for y0
  1950.     }//end for x0
  1951.     //draw frame line
  1952.     FSGUI_FillFrameBuf(xStart+CornerRad, yStart, (xLen - 2*CornerRad), DEMENSION_SIZE, LTColor_Y, LTColor_CRCB); //the top line
  1953.     FSGUI_FillFrameBuf((xStart+xLen-DEMENSION_SIZE), (yStart + CornerRad), DEMENSION_SIZE, (yLen - 2*CornerRad), RBColor_Y, RBColor_CRCB);//the right line
  1954.     FSGUI_FillFrameBuf((xStart + CornerRad ), (yStart + yLen),(xLen - 2*CornerRad), DEMENSION_SIZE, RBColor_Y, RBColor_CRCB);//the bottom line
  1955.     FSGUI_FillFrameBuf(xStart, (yStart + CornerRad), DEMENSION_SIZE, (yLen - 2*CornerRad), LTColor_Y, LTColor_CRCB);//the left line
  1956. }
  1957. //
  1958. // ARROW
  1959. //
  1960. // FUNCTION
  1961. // DrawArrow(x, y, updown)
  1962. //
  1963. // updown=1 --> UP
  1964. // updown=x --> DOWN
  1965. //
  1966. #include "fsgui_icon_arrowx.inc"
  1967. void  DrawArrow(int xStart, int yStart, BYTE updown)
  1968. {
  1969.     FSGUI_DrawIcon(xStart, yStart, ICON_ArrowX, cluty_fsgui, clutc_fsgui, ((updown!=1) ? 0 : FSGUI_ICON_YFLIP));
  1970.     FSGUI_FillFrameBuf(xStart, yStart, ARROW_SIZE, DEMENSION_SIZE, WHITE_Y,WHITE_CRCB);  //top line
  1971.     FSGUI_FillFrameBuf(xStart, yStart, DEMENSION_SIZE, ARROW_SIZE, WHITE_Y,WHITE_CRCB);      //left line
  1972.     FSGUI_FillFrameBuf(xStart+ARROW_SIZE-DEMENSION_SIZE, yStart, DEMENSION_SIZE, ARROW_SIZE, BLACK_Y,BLACK_CRCB); //Right line
  1973.     FSGUI_FillFrameBuf(xStart, yStart+ARROW_SIZE, ARROW_SIZE, DEMENSION_SIZE, BLACK_Y,BLACK_CRCB);//bottom line
  1974. }
  1975. /*
  1976.  * FUNC: to show current dir which is playing.
  1977.  *
  1978.  * Creator: zhaoyanhua
  1979.  * date: 3-7-2 12:56
  1980.  */
  1981. void ShowCurrentDirPlaying()
  1982. {
  1983.     UINT16  dir_now = 0,dir_will = 0;
  1984.     if (pFsJpeg->ControlArea == CNT_AREA_DIR)
  1985.     {
  1986. #if 0//zhoayanhua mask 2004-2-2 17:16
  1987.         if (HL_show == fsnav_dir_HL)
  1988.             return;
  1989. #endif
  1990.     }
  1991.     //clear the last HL DirItem.
  1992.     ClearRectArea(Rect[DIR_RECT], DIR_STEP, DIR_AREA_BKGROUND_CRCB, FS_AREA_DIRITEM, fsnav_dir_HL);
  1993.         ShowDirItem(fsnav_dir_HL, iso9660_dir[pFsJpeg->dir_array[fsnav_dir_HL]].name);//resume the last HL
  1994.     #ifdef NEW_MP3_GUI_DEBUG
  1995.     printf("In ShowCurrentDir  fsnav_dir_will= %d,fsnav_dir_now = %dn",pFsJpeg->fsnav_dir_will,pFsJpeg->fsnav_dir_now);
  1996.     #endif
  1997.     //locate the positon of fsnav_dir_will and fsnav_dir_now  in the current type(MP3/JPEG/GAME).
  1998.     dir_will = antiAnchorDir(pFsJpeg->fsnav_dir_will);
  1999.     dir_now  =  antiAnchorDir(pFsJpeg->fsnav_dir_now);
  2000.     //In the same page ,show the HL.
  2001.     if ((dir_will / PER_PAGE) == (dir_now / PER_PAGE) )
  2002.     {
  2003.         fsnav_dir_HL = dir_now % PER_PAGE;
  2004.         ShowPlayFrame(fsArea[FS_AREA_DIRITEM].xStart - 2, FS_DIRLIST_YSTART - DEMENSION_SIZE + fsnav_dir_HL * FS_FILELIST_YSTEP,HL_Width, HL_Heighth+2);//draw the current HL
  2005.     }
  2006. }
  2007. /*
  2008.  * FUNC: to show current file which is playing
  2009.  *
  2010.  *  Creator: zhaoyanhua
  2011.  *  Date: 3-7-2 12:56
  2012.  */
  2013. void ShowCurrentFilePlaying()
  2014. {
  2015.     //avoid when HL and the current page in the same item,not show HL. zhaoyanhua 3-7-15 21:12
  2016.     if (pFsJpeg->ControlArea == CNT_AREA_FILE)
  2017.     {
  2018.     #if 0
  2019.         if (HL_show == fsnav_file_HL)
  2020.         return;
  2021.     #endif
  2022.     }
  2023.     ClearRectArea(Rect[FILE_RECT], FILE_STEP, FILE_AREA_BKGROUND_CRCB,FS_AREA_FILEITEM, fsnav_file_HL);
  2024.     FSShowFileItem(fsnav_file_HL, iso9660_file[pFsJpeg->file_array[fsnav_file_HL]].name);//resume the last HL
  2025.     #ifdef NEW_MP3_GUI_DEBUG
  2026.     printf("***ShowCurrentFile ,file_page_now = %d,file_page_will = %d,file_current =%dn",pFsJpeg->file_page_now,pFsJpeg->file_page_will,pFsJpeg-> file_current);
  2027.     #endif
  2028.     //In the same page ,show the HL.
  2029.     if ((pFsJpeg->file_page_will) == (pFsJpeg->file_page_now) )
  2030.     {
  2031.         fsnav_file_HL = (pFsJpeg->file_current);
  2032.         ShowPlayFrame(fsArea[FS_AREA_FILEITEM].xStart - 2, FS_DIRLIST_YSTART - DEMENSION_SIZE + fsnav_file_HL * FS_FILELIST_YSTEP,HL_Width, HL_Heighth+2);//draw the current HL
  2033.     }
  2034. }
  2035. /*
  2036.  * FUNC : draw the frame line to show the current playing file or dir.
  2037.  *
  2038.  * zhaoyanhua 3-7-1 19:21
  2039.  */
  2040. void ShowPlayFrame(int x, int y,int len,int high)
  2041. {
  2042.     if((len!=0)&&(high!=0)) {
  2043.         FSGUI_FillFrameBuf(x,y,len,DEMENSION_SIZE,BLACK_Y,BLACK_CRCB);
  2044.         FSGUI_FillFrameBuf(x,y,DEMENSION_SIZE, high,BLACK_Y,BLACK_CRCB);
  2045.     }
  2046.     //draw light line
  2047.     if((len!=0)&&(high!=0)) {
  2048.         FSGUI_FillFrameBuf(x+DEMENSION_SIZE,     y+high-DEMENSION_SIZE,len-DEMENSION_SIZE,DEMENSION_SIZE,WHITE_Y,WHITE_CRCB);
  2049.         FSGUI_FillFrameBuf(x+len-DEMENSION_SIZE, y+DEMENSION_SIZE,    DEMENSION_SIZE,  high-DEMENSION_SIZE,WHITE_Y,WHITE_CRCB);
  2050.     }
  2051. }
  2052. #endif //#ifdef NEW_MP3_GUI
  2053. //-------------------------------------------------------------------
  2054. // Refresh():
  2055. //      Refresh the GUI to display the real-time copying file process
  2056. // liweihua 2004-12-9 14:00
  2057. //-------------------------------------------------------------------
  2058. #ifdef FAT_FILE_MODE//lijd 2005-1-5 19:15
  2059. void Refresh(BYTE copy_process)
  2060. {
  2061.     if(copy_process<=100)
  2062.     {
  2063.         psprintf(linebuf, "COPYING FILE[%d%s]", copy_process,"%");   
  2064.         ShowWarning(linebuf);    
  2065.     }
  2066.     if(copy_process >= 100)
  2067.     {
  2068.         psprintf(linebuf, "COPYING FILE[100%s]", "%");
  2069.         ShowWarning(linebuf);
  2070.     }    
  2071. }
  2072. #elif defined(SUPPORT_MULTI_PARTITION)
  2073. void Refresh(BYTE copy_process)
  2074. {
  2075.     if(copy_process<=100)
  2076.     {
  2077.         psprintf(linebuf, "COPYING FILE[%d%s]", copy_process,"%");   
  2078.         FSGUI_UpdateInfoArea(linebuf);
  2079.         FSGUI_FillFrameBuf(49,237+1,(49+copy_process*2),4,HL_Y,HL_CRCB);    
  2080.     }
  2081.     if(copy_process >= 100)
  2082.     {
  2083.         psprintf(linebuf, "COPYING FILE[100%s]", "%");
  2084.         FSGUI_UpdateInfoArea(linebuf);
  2085.         FSGUI_FillFrameBuf(46,237,255,6,BK_GROUNDY,BK_CRCB);
  2086.     }
  2087. }
  2088. //#else
  2089. //void Refresh(BYTE copy_process)
  2090. //{}
  2091. #endif