1
0

ml_subclass.cpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #include "main.h"
  2. extern void AccessingGracenoteHack(int);
  3. extern HWND subWnd;
  4. // TODO: benski> a lot of things don't need to be part of gen_ml window - they could easily be done with a hidden window
  5. LRESULT APIENTRY ml_newWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  6. {
  7. switch (uMsg)
  8. {
  9. case WM_USER+641:
  10. {
  11. AccessingGracenoteHack(wParam);
  12. break;
  13. }
  14. case WM_ML_IPC:
  15. {
  16. INT_PTR ret = HandleIpcMessage((INT_PTR)lParam, (INT_PTR)wParam);
  17. if (ret != 0)
  18. {
  19. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, ret);
  20. return ret; // supposed to return TRUE but thus is not working for me :(
  21. }
  22. }
  23. break;
  24. case WM_COMMAND:
  25. switch (LOWORD(wParam))
  26. {
  27. case IDM_DOSHITMENU_ADDNEWVIEW:
  28. addNewQuery(hwndDlg);
  29. return 0;
  30. case IDM_ADD_PLEDIT:
  31. add_pledit_to_library();
  32. return 0;
  33. case IDM_ADD_DIRS:
  34. add_to_library(hwndDlg);
  35. return 0;
  36. case IDM_REMOVE_UNUSED_FILES:
  37. Scan_RemoveFiles(hwndDlg);
  38. if (m_curview_hwnd) SendMessage(m_curview_hwnd, WM_APP + 1, 0, 0); //update current view
  39. return 0;
  40. case IDM_RESCANFOLDERSNOW:
  41. if (!g_bgscan_scanning) SendMessage(hwndDlg, WM_USER + 575, 0xffff00dd, 0);
  42. return 0;
  43. }
  44. break;
  45. case WM_USER + 575: //sent by prefs to start scanning
  46. if (wParam == 0xffff00dd && !lParam)
  47. {
  48. if (!g_bgscan_scanning)
  49. {
  50. Scan_BackgroundScan();
  51. }
  52. }
  53. break;
  54. case WM_TIMER:
  55. {
  56. static int in_timer;
  57. if (in_timer) return 0;
  58. in_timer = 1;
  59. if (wParam == 200) // decide if it is time to scan yet
  60. {
  61. if (!g_bgscan_scanning)
  62. {
  63. if (g_bgrescan_force || (g_bgrescan_do && (time(NULL) - g_bgscan_last_rescan) > g_bgrescan_int*60))
  64. {
  65. // send to the prefs page so it'll show the status if it's open
  66. // (makes it easier to see if things are working with the rescan every x option)
  67. if (IsWindow(subWnd)) SendMessage(subWnd, WM_USER+101, 0, 0);
  68. Scan_BackgroundScan();
  69. }
  70. }
  71. in_timer = 0;
  72. return 0;
  73. }
  74. in_timer = 0;
  75. }
  76. break;
  77. }
  78. return CallWindowProc(ml_oldWndProc, hwndDlg, uMsg, wParam, lParam);
  79. }