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

DVD

开发平台:

C/C++

  1. /*****************************************************
  2. Creater: susu
  3. Date   : 2003-8-20 14:40
  4. Description: show double title function 
  5. *****************************************************/
  6. #include "global.h"
  7. #include "osd.h"
  8. #include "func.h"
  9. #include "cfont.h"
  10. #include "util.h"
  11. #include "ircmd.h"
  12. #include "user_if.h" 
  13. #include "stdlib.h"
  14. #include "emuio.h"
  15. #include "sio.h"
  16. #ifdef DOUBLE_TITLE
  17. extern void osd_init_double_title(void);
  18. extern void osd_draw_region_rect(UINT32 xStart, UINT32 yStart, UINT32 xLen, UINT32 yLen, BYTE bkColor, BYTE r);
  19. extern void osd_DrawRegionString(BYTE xStart, BYTE yStart, BYTE *str, BYTE fontColor, BYTE bkColor, BYTE r);
  20. extern void ircmd_sub_picture(void);
  21. void exe_double_title(void);
  22. void exit_double_title(void);
  23. void double_title_func_select(void);
  24. void double_title_func_up(void);
  25. void double_title_func_down(void);
  26. void double_title_func_left(void);
  27. void double_title_func_right(void);
  28. void draw_doubletitle_string(void);
  29. void draw_doubletitle_12space(int i);
  30. #define FIRST_TITLE_ITEM      0//first title choise
  31. #define SECOND_TITLE_ITEM     1//second title choise
  32. #define FONT_COLOR            2//White
  33. #define HL_FONT_COLOR         12//Red
  34. #define ICON_COLOR            9//yellow_green
  35. #define BK_COLOR              0//Transparent
  36. #define X_START_0             5//first title position
  37. #define X_START_1             23//second title position
  38. #define X_START               0
  39. #define Y_START               0
  40. #define X_LINE                36*4*2//display rect length
  41. #define Y_LINE                24+5//display rect hight
  42. int i_title_item=FIRST_TITLE_ITEM; //title item:first title item and second title item
  43. void exit_double_title(void)
  44. {
  45. full_scrn=0;
  46.     osd_init();
  47. }
  48. void exe_double_title(void)
  49. {
  50. osd_init_double_title();
  51. action_click=0;
  52. //Initialize double tile
  53. osd_draw_region_rect(X_START,X_START,X_LINE*2,Y_LINE-2,BK_COLOR,REGION1);
  54. draw_doubletitle_string();
  55. i_title_item=FIRST_TITLE_ITEM;
  56. }
  57. void double_title_func_up(void)//press up button
  58. {
  59. if(i_title_item==FIRST_TITLE_ITEM)
  60. {
  61. draw_doubletitle_12space(0);
  62. memset(linebuf,0,sizeof(linebuf));
  63. ircmd_sub_picture();
  64. osd_DrawRegionString(X_START_0,Y_START,linebuf,HL_FONT_COLOR,BK_COLOR,REGION1);
  65. strcpy(linebuf_0,linebuf);
  66. }
  67. else
  68. {
  69. draw_doubletitle_12space(1);
  70. memset(linebuf,0,sizeof(linebuf));
  71. ircmd_sub_picture();
  72. osd_DrawRegionString(X_START_1,Y_START,linebuf,HL_FONT_COLOR,BK_COLOR,REGION1);
  73. strcpy(linebuf_1,linebuf);
  74. }
  75. }
  76. void double_title_func_down(void)//press down button
  77. {
  78.     printf("double_title_func_downn");
  79. if(i_title_item==FIRST_TITLE_ITEM)
  80. {
  81. draw_doubletitle_12space(0);
  82. memset(linebuf,0,sizeof(linebuf));
  83. ircmd_sub_picture();
  84. osd_DrawRegionString(X_START_0,Y_START,linebuf,HL_FONT_COLOR,BK_COLOR,REGION1);
  85. strcpy(linebuf_0,linebuf);
  86. }
  87. else
  88. {
  89. draw_doubletitle_12space(1);
  90. memset(linebuf,0,sizeof(linebuf));
  91. ircmd_sub_picture();
  92. osd_DrawRegionString(X_START_1,Y_START,linebuf,HL_FONT_COLOR,BK_COLOR,REGION1);
  93. strcpy(linebuf_1,linebuf);
  94. }
  95. }
  96. void double_title_func_right(void)//press right button
  97. {
  98. action_click=0;
  99. i_title_item=SECOND_TITLE_ITEM;
  100. draw_doubletitle_12space(1);
  101. memset(linebuf,0,sizeof(linebuf));
  102. if(strlen(linebuf_1)==0)
  103. {
  104. ircmd_sub_picture();
  105. osd_DrawRegionString(X_START_0,Y_START,linebuf,FONT_COLOR,0,REGION1);
  106. }
  107. if(strlen(linebuf_1)==0)
  108. {
  109. psprintf(linebuf,"    [ %s ]",_OsdMessegeFont1[osd_font_mode][STR_OS_OFF]);
  110. osd_DrawRegionString(X_START_1, Y_START, linebuf, HL_FONT_COLOR, BK_COLOR,REGION1);
  111. }
  112. osd_DrawRegionString(X_START_0, Y_START, linebuf_0, FONT_COLOR, BK_COLOR,REGION1);
  113. osd_DrawRegionString(X_START_1, Y_START, linebuf_1, HL_FONT_COLOR, BK_COLOR,REGION1);
  114. }
  115. void double_title_func_left(void)//press left button
  116. {
  117. action_click=0;
  118. i_title_item=FIRST_TITLE_ITEM;
  119. draw_doubletitle_12space(0);
  120. memset(linebuf,0,sizeof(linebuf));
  121. if(strlen(linebuf_0)==0)
  122. {
  123. ircmd_sub_picture();
  124. osd_DrawRegionString(X_START_0,Y_START,linebuf,HL_FONT_COLOR,0,REGION1);
  125. }
  126. if(strlen(linebuf_1)==0)
  127. {
  128. psprintf(linebuf,"    [ %s ]",_OsdMessegeFont1[osd_font_mode][STR_OS_OFF]);
  129. osd_DrawRegionString(X_START_1, Y_START, linebuf, FONT_COLOR, BK_COLOR,REGION1);
  130. }
  131. osd_DrawRegionString(X_START_0,Y_START,linebuf_0,HL_FONT_COLOR,BK_COLOR,REGION1);
  132. osd_DrawRegionString(X_START_1,Y_START, linebuf_1,FONT_COLOR, BK_COLOR,REGION1);
  133. }
  134. void double_title_func_select(void)
  135. {
  136. //exit_double_title();
  137. }
  138. void draw_doubletitle_string(void)
  139. {//write subtitle string
  140. psprintf(linebuf,"%s:",_OsdMessegeFont1[osd_font_mode][STR_OS_SUBTITLE]);
  141. osd_DrawRegionString(X_START, Y_START, linebuf, ICON_COLOR, BK_COLOR,REGION1);
  142. if(strlen(linebuf_0)==0)
  143. {
  144.   ircmd_sub_picture();
  145. osd_DrawRegionString(X_START_0,Y_START,linebuf,HL_FONT_COLOR,0,REGION1);
  146. psprintf(linebuf,"    [ %s ]",_OsdMessegeFont1[osd_font_mode][STR_OS_OFF]);
  147. osd_DrawRegionString(X_START_1, Y_START, linebuf, FONT_COLOR, BK_COLOR,REGION1);
  148. }
  149. if(strlen(linebuf_1)==0)
  150. {
  151. psprintf(linebuf,"    [ %s ]",_OsdMessegeFont1[osd_font_mode][STR_OS_OFF]);
  152. osd_DrawRegionString(X_START_1, Y_START, linebuf, FONT_COLOR, BK_COLOR,REGION1);
  153. }
  154. osd_DrawRegionString(X_START_0,Y_START,linebuf_0,HL_FONT_COLOR,0,REGION1);
  155. osd_DrawRegionString(X_START_1, Y_START, linebuf_1, FONT_COLOR, BK_COLOR,REGION1);
  156. }
  157. void draw_doubletitle_12space(int i)//12 blank
  158. {//erase displayed word and disp new word when press updown key(for draw right item)
  159. strcpy(linebuf, "            ");
  160. osd_DrawRegionString(18*i+5,Y_START, linebuf,FONT_COLOR,BK_COLOR,REGION1);
  161. }
  162. #endif