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

DVD

开发平台:

C/C++

  1. #include "user_init.h"
  2. #include "global.h"
  3. #include "func.h" 
  4. #include "memmap.h"
  5. #include "util.h" 
  6. #include "graph.h"
  7. #include "framebuf.h"
  8. #include "macro.h"
  9. #include "stc.h"
  10. #include "cfont.h"
  11. #include "vfdfunc.h"
  12. #include "osd.h"
  13. #include "image.h"
  14. #include "nesinit.h"
  15. #include "fs96602.h"
  16. #include "fsNAV.h"
  17. #include "fsGUI.h"
  18. #include "fsGUI1.h"
  19. #ifdef JPG_EFFECT
  20. #include "jpegeffect.h"
  21. #endif
  22. #ifdef FSGUI_NO_BLINK_SCROLL
  23. //*******************************************************
  24. //function: DrawRectShadow()
  25. //description: Draw rectangle edge line,up or down effect.
  26. //creator: xulf
  27. //date:2003-12-09
  28. //*******************************************************
  29. void DrawRectShadow(int x,int y,int xSize,int ySize,BYTE updown_sign)
  30. {
  31. #ifdef AUDIO_SHOW_SAVER
  32.     if (bDisableGUI) return;
  33. #endif
  34. if(updown_sign ==1)
  35. {
  36.     FSGUI_FillFrameBuf(x, y, xSize, 1, BLACK_Y, BLACK_CRCB);
  37.     FSGUI_FillFrameBuf(x, y, 1, ySize, BLACK_Y, BLACK_CRCB);
  38.     FSGUI_FillFrameBuf(x + xSize - 1, y + 1, 1, ySize - 1, WHITE_Y, WHITE_CRCB);
  39.     FSGUI_FillFrameBuf(x + 1, y + ySize - 1, xSize - 1, 1 ,WHITE_Y, WHITE_CRCB);
  40. }
  41. else
  42. {
  43.     FSGUI_FillFrameBuf(x, y, xSize, 1, WHITE_Y, WHITE_CRCB);
  44.     FSGUI_FillFrameBuf(x, y, 1, ySize, WHITE_Y, WHITE_CRCB);
  45.     FSGUI_FillFrameBuf(x + xSize - 1, y, 1, ySize, BLACK_Y, BLACK_CRCB);
  46.     FSGUI_FillFrameBuf(x, y + ySize - 1, xSize ,1 ,BLACK_Y, BLACK_CRCB);
  47. }
  48. }
  49. //*******************************************************
  50. //function: MoveScroll()
  51. //description: redraw changed section of scollbar when 
  52. //                press up_down buttons or refresh fsGUI.
  53. //creator: xulf
  54. //date:2003-12-09
  55. //*******************************************************
  56. void MoveScroll(UINT16 locate,INT8 move_sign)
  57. {
  58. int y;
  59. if ((fsArea[FS_AREA_MOVEBAR].ySize - pFsJpeg->scroll_len) >= (pFsJpeg->file_specify_in_dir - 1))
  60. y = fsArea[FS_AREA_MOVEBAR].yStart + locate * pFsJpeg->scroll_step;
  61. else
  62. y = fsArea[FS_AREA_MOVEBAR].yStart + locate * pFsJpeg->scroll_step / 10;
  63. if(move_sign == SCROLLBAR_DOWN)
  64. {
  65.     FSGUI_FillFrameBuf(fsArea[FS_AREA_MOVEBAR].xStart, y-pFsJpeg->scroll_step, 
  66.         fsArea[FS_AREA_MOVEBAR].xSize, pFsJpeg->scroll_step+1, BK_GROUNDY-0x20, BK_GROUNDCRCB);
  67. FSGUI_FillFrameBuf(fsArea[FS_AREA_MOVEBAR].xStart, y-pFsJpeg->scroll_step+pFsJpeg->scroll_len-2, 
  68.     fsArea[FS_AREA_MOVEBAR].xSize, pFsJpeg->scroll_step+2, BK_GROUNDY, BK_GROUNDCRCB);
  69. DrawRectShadow(fsArea[FS_AREA_MOVEBAR].xStart,y,fsArea[FS_AREA_MOVEBAR].xSize, pFsJpeg->scroll_len, 0);
  70. }
  71. else if(move_sign == SCROLLBAR_UP)
  72. {
  73.     FSGUI_FillFrameBuf(fsArea[FS_AREA_MOVEBAR].xStart, y, fsArea[FS_AREA_MOVEBAR].xSize,
  74.         pFsJpeg->scroll_step+1, BK_GROUNDY, BK_GROUNDCRCB);
  75. FSGUI_FillFrameBuf(fsArea[FS_AREA_MOVEBAR].xStart, y+pFsJpeg->scroll_len, 
  76.     fsArea[FS_AREA_MOVEBAR].xSize, pFsJpeg->scroll_step, BK_GROUNDY-0x20, BK_GROUNDCRCB);
  77. DrawRectShadow(fsArea[FS_AREA_MOVEBAR].xStart,y,fsArea[FS_AREA_MOVEBAR].xSize, pFsJpeg->scroll_len, 0);
  78. }
  79. else
  80. {
  81. DrawScroll();
  82. DrawRect(fsArea[FS_AREA_MOVEBAR].xStart, y, fsArea[FS_AREA_MOVEBAR].xSize, pFsJpeg->scroll_len, 
  83. 0, BK_GROUNDY, BK_GROUNDCRCB);
  84. }
  85. return;
  86. }
  87. #else
  88. void MoveScroll(UINT16 locate)
  89. {
  90. int y;
  91. DrawScroll();
  92. if ((fsArea[FS_AREA_MOVEBAR].ySize - pFsJpeg->scroll_len) >= (pFsJpeg->file_specify_in_dir - 1))
  93. y = fsArea[FS_AREA_MOVEBAR].yStart + locate * pFsJpeg->scroll_step;
  94. else
  95. y = fsArea[FS_AREA_MOVEBAR].yStart + locate * pFsJpeg->scroll_step / 10;
  96. DrawRect(fsArea[FS_AREA_MOVEBAR].xStart, y, fsArea[FS_AREA_MOVEBAR].xSize, pFsJpeg->scroll_len, 0,
  97. BK_GROUNDY, BK_GROUNDCRCB);
  98. return;
  99. }
  100. #endif
  101. void DrawScroll(void)
  102. {
  103. DrawRect(fsArea[FS_AREA_SLOT].xStart, fsArea[FS_AREA_SLOT].yStart,
  104. fsArea[FS_AREA_SLOT].xSize, fsArea[FS_AREA_SLOT].ySize,
  105. 1, BK_GROUNDY-0x20, BK_GROUNDCRCB);
  106. return;
  107. }
  108. void SelectHL()
  109. {
  110. if ((pFsJpeg->ControlArea == CNT_AREA_FILE) || (pFsJpeg->ControlArea == CNT_AREA_DIR))
  111. {
  112. ShowButtonHL(0, 0, 0);
  113. if (pFsJpeg->ControlArea == CNT_AREA_FILE)
  114. {
  115. //Jeff 20020521
  116. int iFiles, iWidth;
  117. #ifdef MP3_DIRECT_SELECT
  118. iFiles = pFsJpeg->count_file[pFsJpeg->gifsFuncBtn - FS_FUNC_MP3];
  119. #else
  120. iFiles = pFsJpeg->file_specify_in_dir;
  121. #endif
  122. if (iFiles>999)
  123. iWidth = 46;
  124. else if (iFiles>99)
  125. iWidth = 38;
  126. else iWidth = 28;
  127. ShowHL(fsArea[FS_AREA_FILEITEM].xStart - 2, FS_DIRLIST_YSTART - 1 + pFsJpeg->file_will * FS_FILELIST_YSTEP, iWidth, 14);
  128. }
  129. else if (pFsJpeg->ControlArea == CNT_AREA_DIR)
  130. ShowHL(fsArea[FS_AREA_DIRITEM].xStart - 2, FS_DIRLIST_YSTART - 1 + pFsJpeg->dir_current * FS_FILELIST_YSTEP, 28, 14);
  131. }
  132. else
  133. {
  134. ShowHL(0,0,0,0);
  135. if (pFsJpeg->ControlArea == CNT_AREA_MP3BUTTON)
  136. {
  137.   #ifdef NO_LIRIC_ID3 //caohui 2004-4-23 06:36
  138. ShowButtonHL(fsArea[FS_AREA_BUTTON].xStart + 3+40, fsArea[FS_AREA_BUTTON].yStart -203, 19);
  139.   #else
  140. ShowButtonHL(fsArea[FS_AREA_BUTTON].xStart + 3, fsArea[FS_AREA_BUTTON].yStart + 3, 19);
  141.   #endif
  142. }
  143. else if (pFsJpeg->ControlArea == CNT_AREA_JPEGBUTTON)
  144. {
  145.  #ifdef NO_LIRIC_ID3 //caohui 2004-4-23 06:36
  146. ShowButtonHL(fsArea[FS_AREA_BUTTON].xStart + 3 + 92,fsArea[FS_AREA_BUTTON].yStart-203, 15);
  147.              #else
  148. ShowButtonHL(fsArea[FS_AREA_BUTTON].xStart + 3 + 27,fsArea[FS_AREA_BUTTON].yStart + 3, 19);
  149.             #endif
  150.         }
  151. #ifdef SUPPORT_NESGAME //Jeff 20020521
  152. else if (pFsJpeg->ControlArea == CNT_AREA_GAMEBUTTON)
  153. ShowButtonHL(fsArea[FS_AREA_BUTTON].xStart + 3 + 54, fsArea[FS_AREA_BUTTON].yStart + 3, 19);
  154. #endif
  155. #ifdef SUPPORT_FILE_SYSTEM_MODE // Robert 020930
  156. else if (pFsJpeg->ControlArea == CNT_AREA_OTHERBUTTON)
  157. #ifdef SUPPORT_NESGAME
  158. ShowButtonHL(fsArea[FS_AREA_BUTTON].xStart + 3 + 81, fsArea[FS_AREA_BUTTON].yStart + 3, 19);
  159. #else
  160. ShowButtonHL(fsArea[FS_AREA_BUTTON].xStart + 3 + 54, fsArea[FS_AREA_BUTTON].yStart + 3, 19);
  161. #endif
  162. #endif
  163. #ifdef SUPPORT_MIDI
  164.         else if(pFsJpeg->ControlArea == CNT_AREA_MIDIBUTTON) {
  165. #ifdef SUPPORT_FILE_SYSTEM_MODE
  166. #ifdef SUPPORT_NESGAME
  167.             ShowButtonHL(fsArea[FS_AREA_BUTTON].xStart + 3 + 108, fsArea[FS_AREA_BUTTON].yStart + 3, 19);
  168. #else //SUPPORT_NESGAME
  169.             ShowButtonHL(fsArea[FS_AREA_BUTTON].xStart + 3 + 81, fsArea[FS_AREA_BUTTON].yStart + 3, 19);
  170. #endif //SUPPORT_NESGAME
  171. #else //SUPPORT_FILE_SYSTEM_MODE
  172. #ifdef SUPPORT_NESGAME
  173.             ShowButtonHL(fsArea[FS_AREA_BUTTON].xStart + 3 + 81, fsArea[FS_AREA_BUTTON].yStart + 3, 19);
  174. #else //SUPPORT_NESGAME
  175.             ShowButtonHL(fsArea[FS_AREA_BUTTON].xStart + 3 + 54, fsArea[FS_AREA_BUTTON].yStart + 3, 19);
  176. #endif //SUPPORT_NESGAME
  177. #endif //SUPPORT_FILE_SYSTEM_MODE
  178.         }
  179. #endif //SUPPORT_MIDI
  180. }
  181. }
  182. void ShowButtonHL(int x, int y,int len)
  183. {
  184. // resume preview HL
  185. if(Hl_len_btn!=0)
  186. #ifdef NO_LIRIC_ID3
  187. DrawRectEdge(Hl_x_btn,Hl_y_btn,44,12,BK_GROUNDY,BK_GROUNDCRCB);
  188. #else
  189. DrawRectEdge(Hl_x_btn,Hl_y_btn,Hl_len_btn,Hl_len_btn,BK_GROUNDY,BK_GROUNDCRCB);
  190. #endif
  191. // draw current HL
  192. if (len!=0)
  193. {
  194.      #ifdef NO_LIRIC_ID3 
  195.     DrawRectEdge(x,y,44,12,WHITE_Y,WHITE_CRCB);
  196.           #else
  197.           printf("=======here is 4=======n");
  198. DrawRectEdge(x,y,len,len,BLACK_Y,BLACK_CRCB);
  199.     
  200.     #endif
  201.  } 
  202. Hl_x_btn = x;
  203. Hl_y_btn = y;
  204. Hl_len_btn = len;
  205. }
  206. void ShowHL(int x, int y,int len,int high)
  207. {
  208. #ifdef AUDIO_SHOW_SAVER
  209.     if (bDisableGUI) return;
  210. #endif
  211. //if ( (x>351) || (y>287) )  return;
  212. //if ( (x<0) || (y<0) ) return;
  213. // resume preview HL
  214. if((Hl_len!=0)&&(Hl_high!=0))
  215. FSGUI_ReplaceFrameBuf(Hl_x,Hl_y,Hl_len,Hl_high,HL_Y,HL_CRCB,BK_GROUNDY,BK_GROUNDCRCB);
  216. // draw current HL
  217. if ( (len!=0) && (high!=0) ) {
  218. FSGUI_ReplaceFrameBuf(x,y,len,high,BK_GROUNDY,BK_GROUNDCRCB,HL_Y,HL_CRCB);
  219. }
  220. //resume shadow
  221. if((Hl_len!=0)&&(Hl_high!=0)) {    
  222. FSGUI_FillFrameBuf(Hl_x,Hl_y,Hl_len,1,BK_GROUNDY,BK_GROUNDCRCB);
  223. FSGUI_FillFrameBuf(Hl_x,Hl_y,1,Hl_high,BK_GROUNDY,BK_GROUNDCRCB);
  224. }
  225. //draw shadow
  226. if((len!=0)&&(high!=0)) {
  227. FSGUI_FillFrameBuf(x,y,len,1,BLACK_Y,BLACK_CRCB);
  228. FSGUI_FillFrameBuf(x,y,1, high,BLACK_Y,BLACK_CRCB);
  229. }
  230. // resume light line
  231. if((Hl_len!=0)&&(Hl_high!=0)) {
  232. FSGUI_FillFrameBuf(Hl_x+1, Hl_y+Hl_high-1,Hl_len-1, 1, BK_GROUNDY,BK_GROUNDCRCB);
  233. FSGUI_FillFrameBuf(Hl_x+Hl_len-1, Hl_y+1, 1,Hl_high-1, BK_GROUNDY,BK_GROUNDCRCB);
  234.        
  235. }
  236. //draw light line
  237. if((len!=0)&&(high!=0)) {
  238. FSGUI_FillFrameBuf(x+1, y+high-1,len-1,1,WHITE_Y,WHITE_CRCB);
  239. FSGUI_FillFrameBuf(x+len-1, y+1, 1, high-1,WHITE_Y,WHITE_CRCB);
  240. }
  241.     
  242. Hl_x = x;
  243. Hl_y = y;
  244. Hl_len = len;
  245. Hl_high = high;
  246. }