1
0

draw_vw.cpp 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. /** (c) Nullsoft, Inc. C O N F I D E N T I A L
  2. ** Filename:
  3. ** Project:
  4. ** Description:
  5. ** Author:
  6. ** Created:
  7. **/
  8. #include "Main.h"
  9. #include "draw.h"
  10. #include "resource.h"
  11. #include "WADrawDC.h"
  12. HBITMAP vwMainBM;
  13. extern "C" int vw_init=0;
  14. void draw_vw_init()
  15. {
  16. if (vw_init)
  17. draw_vw_kill();
  18. vw_init=1;
  19. vwMainBM = draw_LBitmap(MAKEINTRESOURCE(IDB_VIDEO),L"video.bmp");
  20. }
  21. void draw_vw_kill()
  22. {
  23. if (!vw_init)
  24. return;
  25. DeleteObject(vwMainBM);
  26. }
  27. void draw_vw_mbuts(int whichb)
  28. {
  29. if (!disable_skin_borders && hVideoWindow && vw_init)
  30. {
  31. int numb=5;
  32. int x;
  33. WADrawDC hdcout(hVideoWindow);
  34. do_palmode(hdcout);
  35. setSrcBM(vwMainBM);
  36. for (x = 0; x < numb; x ++)
  37. {
  38. int nx=9+x*15;
  39. int ny=51;
  40. if (x==whichb)
  41. {
  42. nx+=158-9;
  43. ny=42;
  44. }
  45. BitBlt(hdcout,9+x*15,config_video_height-29,15,18,bmDC,nx,ny,SRCCOPY);
  46. }
  47. unsetSrcBM();
  48. }
  49. }
  50. void draw_vw_tbar(int state)
  51. {
  52. if (!disable_skin_borders && hVideoWindow && vw_init)
  53. {
  54. WADrawDC hdcout(hVideoWindow);
  55. state = state?0:21;
  56. do_palmode(hdcout);
  57. setSrcBM(vwMainBM);
  58. {
  59. int nt;
  60. int xp=0;
  61. BitBlt(hdcout,xp,0,25,20,bmDC,0,state,SRCCOPY);
  62. xp+=25;
  63. nt = (config_video_width - 25 - 25 - 100)/25;
  64. if (nt)
  65. {
  66. if (nt&1)
  67. {
  68. BitBlt(hdcout,xp,0,12,20,bmDC,127,state,SRCCOPY);
  69. xp+=12;
  70. }
  71. nt/=2;
  72. while (nt-->0)
  73. {
  74. BitBlt(hdcout,xp,0,25,20,bmDC,127,state,SRCCOPY);
  75. xp+=25;
  76. }
  77. }
  78. BitBlt(hdcout,xp,0,100,20,bmDC,26,state,SRCCOPY);
  79. xp+=100;
  80. nt = (config_video_width - 25 - 25 - 100)/25;
  81. if (nt)
  82. {
  83. if (nt&1)
  84. {
  85. BitBlt(hdcout,xp,0,13,20,bmDC,127,state,SRCCOPY);
  86. xp+=13;
  87. }
  88. nt/=2;
  89. while (nt-->0)
  90. {
  91. BitBlt(hdcout,xp,0,25,20,bmDC,127,state,SRCCOPY);
  92. xp+=25;
  93. }
  94. }
  95. nt = (config_video_width - 25 -25 - 100) %25;
  96. if (nt)
  97. {
  98. StretchBlt(hdcout,xp,0,nt,20,bmDC,127,state,25,20,SRCCOPY);
  99. xp+=nt;
  100. }
  101. BitBlt(hdcout,xp,0,25,20,bmDC,153,state,SRCCOPY);
  102. }
  103. unsetSrcBM();
  104. }
  105. }
  106. void draw_vw(HDC hdcout)
  107. {
  108. if (!hVideoWindow || !vw_init)
  109. return;
  110. do_palmode(hdcout);
  111. draw_vw_tbar(GetForegroundWindow()==hVideoWindow?1:(config_hilite?0:1));
  112. if (!disable_skin_borders)
  113. {
  114. setSrcBM(vwMainBM);
  115. {
  116. int y=(config_video_height-20-38)/29;
  117. int yp=20,x,xp;
  118. while (y-->0)
  119. {
  120. BitBlt(hdcout,0,yp,11,29,bmDC,127,42,SRCCOPY);
  121. BitBlt(hdcout,config_video_width-8,yp,8,29,bmDC,139,42,SRCCOPY);
  122. yp += 29;
  123. }
  124. y=(config_video_height-20-38)%29;
  125. if (y)
  126. {
  127. StretchBlt(hdcout,0,yp,11,y,bmDC,127,42,11,29,SRCCOPY);
  128. StretchBlt(hdcout,config_video_width-8,yp,8,y,bmDC,139,42,8,29,SRCCOPY);
  129. yp += y;
  130. }
  131. BitBlt(hdcout,0,yp,125,38,bmDC,0,42,SRCCOPY);
  132. x=(config_video_width-125-125)/25;
  133. xp=125;
  134. while (x-->0)
  135. {
  136. BitBlt(hdcout,xp,yp,25,38,bmDC,127,81,SRCCOPY);
  137. xp+=25;
  138. }
  139. x=(config_video_width-125-125)%25;
  140. if (x)
  141. {
  142. StretchBlt(hdcout,xp,yp,x,38,bmDC,127,81,25,38,SRCCOPY);
  143. xp+=x;
  144. }
  145. BitBlt(hdcout,xp,yp,125,38,bmDC,0,81,SRCCOPY);
  146. draw_vw_info(NULL,0);
  147. }
  148. unsetSrcBM();
  149. }
  150. }
  151. wchar_t draw_vw_info_lastb[512] = {0};
  152. void draw_vw_info(wchar_t *t, int erase)
  153. {
  154. if (!disable_skin_borders && hVideoWindow&&vw_init)
  155. {
  156. WADrawDC hdcout(hVideoWindow);
  157. if (!t) t=draw_vw_info_lastb;
  158. else lstrcpynW(draw_vw_info_lastb,t,sizeof(draw_vw_info_lastb));
  159. if (erase)
  160. {
  161. //int y=(config_video_height-20-38)/29;
  162. int yp=config_video_height-38,x,xp;
  163. do_palmode(hdcout);
  164. setSrcBM(vwMainBM);
  165. BitBlt(hdcout,0,yp,125,38,bmDC,0,42,SRCCOPY);
  166. x=(config_video_width-125-125)/25;
  167. xp=125;
  168. while (x-->0)
  169. {
  170. BitBlt(hdcout,xp,yp,25,38,bmDC,127,81,SRCCOPY);
  171. xp+=25;
  172. }
  173. x=(config_video_width-125-125)%25;
  174. if (x)
  175. {
  176. StretchBlt(hdcout,xp,yp,x,38,bmDC,127,81,25,38,SRCCOPY);
  177. xp+=x;
  178. }
  179. BitBlt(hdcout,xp,yp,125,38,bmDC,0,81,SRCCOPY);
  180. unsetSrcBM();
  181. }
  182. RECT r={92,config_video_height-27,config_video_width-25,config_video_height-13};
  183. HGDIOBJ oldFont=SelectObject(hdcout,mfont);
  184. SetTextColor(hdcout,Skin_PLColors[4]);
  185. SetBkColor(hdcout,Skin_PLColors[5]);
  186. DrawTextW(hdcout,t,-1,&r,DT_SINGLELINE|DT_LEFT|DT_NOPREFIX);
  187. SelectObject(hdcout,oldFont);
  188. }
  189. }
  190. void draw_paint_vw(HWND hwnd)
  191. {
  192. if (!hVideoWindow || !vw_init)
  193. return;
  194. PAINTSTRUCT ps;
  195. RECT r;
  196. EnterCriticalSection(&g_mainwndcs);
  197. draw_vw(BeginPaint(hwnd,&ps));
  198. r=ps.rcPaint;
  199. EndPaint(hwnd,&ps);
  200. LeaveCriticalSection(&g_mainwndcs);
  201. }
  202. void draw_vw_tbutton(int b3)
  203. {
  204. if (!disable_skin_borders && hVideoWindow && vw_init)
  205. {
  206. WADrawDC hdcout(hVideoWindow);
  207. do_palmode(hdcout);
  208. setSrcBM(vwMainBM);
  209. if (!b3)
  210. BitBlt(hdcout,config_video_width-11,3,9,9,bmDC,167,3,SRCCOPY);
  211. else
  212. BitBlt(hdcout,config_video_width-11,3,9,9,bmDC,148,42,SRCCOPY);
  213. unsetSrcBM();
  214. }
  215. }