config.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include "main.h"
  2. #include "api__in_mp4.h"
  3. #include "../nu/AutoChar.h"
  4. #include "resource.h"
  5. bool config_show_average_bitrate = true;
  6. INT_PTR CALLBACK ConfigProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
  7. {
  8. switch(msg)
  9. {
  10. case WM_INITDIALOG:
  11. {
  12. wchar_t exts[1024] = {0};
  13. GetPrivateProfileStringW(L"in_mp4", L"extensionlist", defaultExtensions, exts, 1024, m_ini);
  14. SetDlgItemTextW(hwndDlg, IDC_EXTENSIONLIST, exts);
  15. }
  16. break;
  17. case WM_COMMAND:
  18. switch (LOWORD(wParam))
  19. {
  20. case IDC_DEFAULT:
  21. SetDlgItemTextW(hwndDlg, IDC_EXTENSIONLIST, defaultExtensions);
  22. break;
  23. case IDOK:
  24. {
  25. wchar_t exts[1024] = {0};
  26. GetDlgItemTextW(hwndDlg, IDC_EXTENSIONLIST, exts, 1024);
  27. if (!_wcsicmp(exts, defaultExtensions)) // same as default?
  28. WritePrivateProfileStringW(L"in_mp4", L"extensionlist", 0, m_ini);
  29. else
  30. WritePrivateProfileStringW(L"in_mp4", L"extensionlist", exts, m_ini);
  31. free(mod.FileExtensions);
  32. mod.FileExtensions = BuildExtensions(AutoChar(exts));
  33. EndDialog(hwndDlg, 0);
  34. }
  35. break;
  36. case IDCANCEL:
  37. EndDialog(hwndDlg, 1);
  38. break;
  39. }
  40. break;
  41. }
  42. return 0;
  43. }
  44. void config(HWND hwndParent)
  45. {
  46. WASABI_API_DIALOGBOXW(IDD_CONFIG, hwndParent, ConfigProc);
  47. }