1
0

main_display.cpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 "wa_dlg.h"
  10. #include "../nu/AutoChar.h"
  11. #include "resource.h"
  12. extern "C" extern int g_skinloadedmanually;
  13. int Main_OnGetText(wchar_t *text, int sizeCch)
  14. {
  15. size_t rem;
  16. StringCchCopyExW(text, sizeCch, caption, 0, &rem, 0);
  17. return (int)sizeCch-rem;
  18. }
  19. // evil 256 color mode windows palette handling
  20. int Main_OnQueryNewPalette(HWND hwnd)
  21. {
  22. if (draw_hpal) { // hPal is NULL if we're in hicolor
  23. HDC hdc = GetWindowDC(hwnd);
  24. SelectPalette(hdc,draw_hpal,FALSE);
  25. RealizePalette(hdc);
  26. InvalidateRect(hwnd,NULL,FALSE);
  27. ReleaseDC(hwnd,hdc);
  28. }
  29. return 1;
  30. }
  31. // more 256 color windows palette handling
  32. int Main_OnPaletteChanged(HWND hwnd, HWND hwndPaletteChange)
  33. {
  34. if (draw_hpal)
  35. {
  36. HDC hdc = GetWindowDC(hwnd);
  37. SelectPalette(hdc,draw_hpal,FALSE);
  38. RealizePalette(hdc);
  39. UpdateColors(hdc);
  40. ReleaseDC(hwnd,hdc);
  41. }
  42. return 1;
  43. }
  44. // displaychange handling. This reinitializes bitmaps, to use optimal storage format
  45. // depending on mode (DIB or DDB)
  46. int Main_OnDisplayChange(HWND hwnd)
  47. {
  48. int t=0;
  49. if (g_skinloadedmanually)
  50. {
  51. Skin_Load();
  52. }
  53. if (g_skinmissinggenff)
  54. {
  55. wchar_t msg[512] = {0};
  56. StringCchPrintfW(msg, 512, getStringW(IDS_NO_MODERN_SKIN_SUPPORT, NULL, 0), config_skin);
  57. MessageBoxW(NULL, msg, getStringW(IDS_SKIN_LOAD_ERROR, NULL, 0), MB_ICONWARNING | MB_OK | MB_TOPMOST);
  58. }
  59. draw_setnoupdate(1);
  60. draw_init();
  61. draw_clutterbar(0);
  62. draw_shuffle(config_shuffle,0);
  63. draw_eject(0);
  64. draw_eqplbut(config_eq_open,0,config_pe_open,0);
  65. draw_repeat(config_repeat,0);
  66. draw_buttonbar(-1);
  67. draw_volumebar(config_volume,0);
  68. draw_panbar(config_pan,0);
  69. draw_songname(L"",&t,0);
  70. draw_playicon(playing?paused?4:1:2);
  71. draw_tbar(config_hilite?(GetForegroundWindow() == hMainWindow?1:0):1, config_windowshade,eggstat);
  72. draw_monostereo(-1);
  73. if (playing)
  74. {
  75. draw_bitmixrate(-1,-1);
  76. }
  77. draw_setnoupdate(0);
  78. draw_songname(FileTitle,&ui_songposition,playing?in_getlength():PlayList_getcurrentlength());
  79. // tell other windows
  80. if (IsWindow(hVideoWindow))
  81. SendMessageW(hVideoWindow, WM_DISPLAYCHANGE,0,0);
  82. if (IsWindow(hEQWindow))
  83. SendMessageW(hEQWindow, WM_DISPLAYCHANGE,0,0);
  84. if (IsWindow(hPLWindow))
  85. SendMessageW(hPLWindow, WM_DISPLAYCHANGE,0,0);
  86. /*
  87. if (IsWindow(hMBWindow))
  88. SendMessageW(hVideoWindow, WM_DISPLAYCHANGE,0,0);
  89. */
  90. if (IsWindow(hExternalVisWindow))
  91. SendMessageW(hExternalVisWindow, WM_DISPLAYCHANGE,0,0);
  92. SetTimer(hMainWindow, 101, 250, NULL); // set_aot(-1);
  93. InvalidateRect(hwnd,NULL,FALSE);
  94. //UpdateWindow(hwnd);
  95. EnterCriticalSection(&embedcs);
  96. {
  97. embedWindowState *p =embedwndlist;
  98. while (p)
  99. {
  100. PostMessageW(p->me,WM_DISPLAYCHANGE,0,0);
  101. p=p->link;
  102. }
  103. }
  104. LeaveCriticalSection(&embedcs);
  105. PostMessageW(hMainWindow, WM_WA_IPC, 0, IPC_SKIN_CHANGED);
  106. return 1;
  107. }