1
0

config.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "main.h"
  2. #include "resource.h"
  3. int config_ask=1;
  4. int config_ask_each_album=1;
  5. int config_ignore_gained_album=0;
  6. void DoButtons(HWND hwndDlg)
  7. {
  8. config_ask = IsDlgButtonChecked(hwndDlg, IDC_ASK);
  9. config_ask_each_album = IsDlgButtonChecked(hwndDlg, IDC_ALBUM);
  10. EnableWindow(GetDlgItem(hwndDlg, IDC_ALBUM), config_ask);
  11. EnableWindow(GetDlgItem(hwndDlg, IDC_ALL), config_ask);
  12. }
  13. INT_PTR WINAPI RGConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
  14. {
  15. switch(msg)
  16. {
  17. case WM_INITDIALOG:
  18. CheckDlgButton(hwndDlg, IDC_ASK, config_ask);
  19. if (config_ask_each_album)
  20. CheckDlgButton(hwndDlg, IDC_ALBUM, BST_CHECKED);
  21. else
  22. CheckDlgButton(hwndDlg, IDC_ALL, BST_CHECKED);
  23. DoButtons(hwndDlg);
  24. break;
  25. case WM_DESTROY:
  26. {
  27. config_ask = IsDlgButtonChecked(hwndDlg, IDC_ASK);
  28. config_ask_each_album = IsDlgButtonChecked(hwndDlg, IDC_ALBUM);
  29. WritePrivateProfileStringA("ml_rg", "config_ask", config_ask ? "1" : "0", iniFile);
  30. WritePrivateProfileStringA("ml_rg", "config_ask_each_album", config_ask_each_album ? "1" : "0", iniFile);
  31. break;
  32. }
  33. case WM_COMMAND:
  34. switch(LOWORD(wParam))
  35. {
  36. case IDCANCEL:
  37. case IDOK:
  38. EndDialog(hwndDlg, 0);
  39. break;
  40. case IDC_ASK:
  41. case IDC_ALBUM:
  42. case IDC_ALL:
  43. DoButtons(hwndDlg);
  44. break;
  45. }
  46. break;
  47. }
  48. return 0;
  49. }