1
0

prefs_about.cpp 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #include "precomp__gen_ff.h"
  2. #include "gen.h"
  3. #include "resource.h"
  4. #include "menuactions.h"
  5. #include "wa2frontend.h"
  6. #include "../Agave/Language/api_language.h"
  7. extern const wchar_t *getSkinInfoW();
  8. extern int m_are_we_loaded;
  9. ifc_window *skin_about_group = NULL;
  10. void destroyskinabout()
  11. {
  12. if (skin_about_group)
  13. WASABI_API_SKIN->group_destroy(skin_about_group);
  14. skin_about_group = NULL;
  15. }
  16. INT_PTR CALLBACK ffPrefsProc5(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  17. {
  18. switch (uMsg)
  19. {
  20. case WM_INITDIALOG:
  21. destroyskinabout();
  22. if (m_are_we_loaded)
  23. {
  24. if (WASABI_API_SKIN->group_exists(L"skin.about.group"))
  25. {
  26. skin_about_group = WASABI_API_SKIN->group_create(L"skin.about.group");
  27. if (skin_about_group)
  28. {
  29. skin_about_group->setVirtual(0);
  30. HWND w = GetDlgItem(hwndDlg, IDC_STATIC_GROUP);
  31. skin_about_group->setStartHidden(1);
  32. skin_about_group->init(WASABI_API_WND->main_getRootWnd(), 1);
  33. SetWindowLong(skin_about_group->gethWnd(), GWL_STYLE, GetWindowLong(skin_about_group->gethWnd(), GWL_STYLE) | WS_CHILD);
  34. SetParent(skin_about_group->gethWnd(), w);
  35. SetWindowLong(w, GWL_STYLE, GetWindowLong(w, GWL_STYLE) | WS_CLIPCHILDREN);
  36. RECT r;
  37. GetClientRect(w, &r);
  38. skin_about_group->resize(r.left, r.top, r.right - r.left, r.bottom - r.top);
  39. skin_about_group->setVisible(1);
  40. ShowWindow(skin_about_group->gethWnd(), SW_NORMAL);
  41. ShowWindow(GetDlgItem(hwndDlg, IDC_STATIC_EMPTY), SW_HIDE);
  42. }
  43. else
  44. {
  45. SetDlgItemTextA(hwndDlg, IDC_STATIC_EMPTY, WASABI_API_LNGSTRING(IDS_ERROR_WHILE_LOADING_SKIN_WINDOW));
  46. }
  47. }
  48. else
  49. {
  50. SetDlgItemTextW(hwndDlg, IDC_STATIC_EMPTY, getSkinInfoW());
  51. }
  52. }
  53. else
  54. {
  55. SetDlgItemTextA(hwndDlg, IDC_STATIC_EMPTY, WASABI_API_LNGSTRING(IDS_NO_SKIN_LOADED));
  56. }
  57. return 1;
  58. case WM_DESTROY:
  59. destroyskinabout();
  60. break;
  61. case WM_COMMAND:
  62. switch (LOWORD(wParam))
  63. {
  64. case IDOK: case IDCANCEL:
  65. EndDialog(hwndDlg, 0);
  66. return 0;
  67. case IDC_BUTTON_SKINSPECIFIC:
  68. extern void unpopulateWindowsMenus();
  69. extern TList<HMENU> menulist;
  70. HMENU menu = CreatePopupMenu();
  71. unpopulateWindowsMenus();
  72. MenuActions::installSkinOptions(menu);
  73. menulist.addItem(menu);
  74. HWND w = GetDlgItem(hwndDlg, IDC_BUTTON_SKINSPECIFIC);
  75. RECT r;
  76. GetWindowRect(w, &r);
  77. int n = GetMenuItemCount(menu);
  78. if (n == 1)
  79. {
  80. HMENU submenu = GetSubMenu(menu, 0);
  81. if (submenu != NULL) menu = submenu;
  82. }
  83. else if (n == 0)
  84. {
  85. InsertMenuW(menu, 0, MF_BYPOSITION | MF_STRING | MF_GRAYED, 0, WASABI_API_LNGSTRINGW(IDS_NO_OPTIONS_AVAILABLE_FOR_THIS_SKIN));
  86. }
  87. //DoTrackPopup(menu, TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_LEFTBUTTON, r.left, r.top, wa2.getMainWindow());
  88. TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_LEFTBUTTON, r.left, r.top, 0, wa2.getMainWindow(), NULL);
  89. MenuActions::removeSkinOptions();
  90. return 0;
  91. }
  92. break;
  93. }
  94. return 0;
  95. }