1
0

AdvancedConfigDlg.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * AdvancedConfigDlg.h
  3. * -------------------
  4. * Purpose: Implementation of the advanced settings dialog.
  5. * Notes : (currently none)
  6. * Authors: OpenMPT Devs
  7. * The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
  8. */
  9. #pragma once
  10. #include "openmpt/all/BuildSettings.hpp"
  11. #include "CListCtrl.h"
  12. #if MPT_USTRING_MODE_WIDE
  13. #include <unordered_map>
  14. #else
  15. #include <map>
  16. #endif
  17. OPENMPT_NAMESPACE_BEGIN
  18. #ifdef MPT_MFC_FULL
  19. class CAdvancedSettingsList : public CMFCListCtrlEx
  20. {
  21. private:
  22. std::vector<SettingPath> & m_indexToPath;
  23. public:
  24. CAdvancedSettingsList(std::vector<SettingPath> & indexToPath) : m_indexToPath(indexToPath) {}
  25. COLORREF OnGetCellBkColor(int nRow, int nColumn) override;
  26. COLORREF OnGetCellTextColor(int nRow, int nColumn) override;
  27. };
  28. #endif // MPT_MFC_FULL
  29. class COptionsAdvanced: public CPropertyPage
  30. {
  31. #ifdef MPT_MFC_FULL
  32. using ListCtrl = CAdvancedSettingsList;
  33. #else // MPT_MFC_FULL
  34. using ListCtrl = CListCtrlEx;
  35. #endif // !MPT_MFC_FULL
  36. protected:
  37. ListCtrl m_List;
  38. #if MPT_USTRING_MODE_WIDE
  39. using GroupMap = std::unordered_map<mpt::ustring, int>;
  40. #else
  41. using GroupMap = std::map<mpt::ustring, int>;
  42. #endif
  43. std::vector<SettingPath> m_indexToPath;
  44. GroupMap m_groups;
  45. bool m_listGrouped = false;
  46. public:
  47. #ifdef MPT_MFC_FULL
  48. COptionsAdvanced():CPropertyPage(IDD_OPTIONS_ADVANCED), m_List(m_indexToPath) {}
  49. #else // !MPT_MFC_FULL
  50. COptionsAdvanced():CPropertyPage(IDD_OPTIONS_ADVANCED) {}
  51. #endif // MPT_MFC_FULL
  52. protected:
  53. BOOL OnInitDialog() override;
  54. void OnOK() override;
  55. BOOL OnSetActive() override;
  56. void DoDataExchange(CDataExchange* pDX) override;
  57. BOOL PreTranslateMessage(MSG *msg) override;
  58. afx_msg void OnOptionDblClick(NMHDR *, LRESULT *);
  59. afx_msg void OnSettingsChanged() { SetModified(TRUE); }
  60. afx_msg void OnFindStringChanged() { ReInit(); }
  61. afx_msg void OnSaveNow();
  62. #ifndef MPT_MFC_FULL
  63. afx_msg void OnCustomDrawList(NMHDR* pNMHDR, LRESULT* pResult);
  64. #endif // !MPT_MFC_FULL
  65. void ReInit();
  66. DECLARE_MESSAGE_MAP();
  67. };
  68. OPENMPT_NAMESPACE_END