1
0

ChannelManagerDlg.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * ChannelManagerDlg.h
  3. * -------------------
  4. * Purpose: Dialog class for moving, removing, managing channels
  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 "PatternEditorDialogs.h"
  12. OPENMPT_NAMESPACE_BEGIN
  13. class CModDoc;
  14. class CChannelManagerDlg: public CDialog
  15. {
  16. enum Tab
  17. {
  18. kSoloMute = 0,
  19. kRecordSelect = 1,
  20. kPluginState = 2,
  21. kReorderRemove = 3,
  22. };
  23. public:
  24. static CChannelManagerDlg * sharedInstance() { return sharedInstance_; }
  25. static CChannelManagerDlg * sharedInstanceCreate();
  26. static void DestroySharedInstance() { delete sharedInstance_; sharedInstance_ = nullptr; }
  27. void SetDocument(CModDoc *modDoc);
  28. CModDoc *GetDocument() const { return m_ModDoc; }
  29. bool IsDisplayed() const;
  30. void Update(UpdateHint hint, CObject* pHint);
  31. void Show();
  32. void Hide();
  33. private:
  34. static CChannelManagerDlg *sharedInstance_;
  35. QuickChannelProperties m_quickChannelProperties;
  36. protected:
  37. enum ButtonAction : uint8
  38. {
  39. kUndetermined,
  40. kAction1,
  41. kAction2,
  42. };
  43. enum MouseButton : uint8
  44. {
  45. CM_BT_NONE,
  46. CM_BT_LEFT,
  47. CM_BT_RIGHT,
  48. };
  49. CChannelManagerDlg();
  50. ~CChannelManagerDlg();
  51. CHANNELINDEX memory[4][MAX_BASECHANNELS];
  52. std::array<CHANNELINDEX, MAX_BASECHANNELS> pattern;
  53. std::bitset<MAX_BASECHANNELS> removed;
  54. std::bitset<MAX_BASECHANNELS> select;
  55. std::bitset<MAX_BASECHANNELS> state;
  56. CRect move[MAX_BASECHANNELS];
  57. CRect m_drawableArea;
  58. CModDoc *m_ModDoc = nullptr;
  59. HBITMAP m_bkgnd = nullptr;
  60. Tab m_currentTab = kSoloMute;
  61. int m_downX = 0, m_downY = 0;
  62. int m_moveX = 0, m_moveY = 0;
  63. int m_buttonHeight = 0;
  64. ButtonAction m_buttonAction;
  65. bool m_leftButton = false;
  66. bool m_rightButton = false;
  67. bool m_moveRect = false;
  68. bool m_show = false;
  69. bool ButtonHit(CPoint point, CHANNELINDEX *id, CRect *invalidate) const;
  70. void MouseEvent(UINT nFlags, CPoint point, MouseButton button);
  71. void ResetState(bool bSelection = true, bool bMove = true, bool bButton = true, bool bInternal = true, bool bOrder = false);
  72. void ResizeWindow();
  73. //{{AFX_VIRTUAL(CChannelManagerDlg)
  74. BOOL OnInitDialog() override;
  75. //}}AFX_VIRTUAL
  76. //{{AFX_MSG(CChannelManagerDlg)
  77. afx_msg void OnApply();
  78. afx_msg void OnClose();
  79. afx_msg void OnSelectAll();
  80. afx_msg void OnInvert();
  81. afx_msg void OnAction1();
  82. afx_msg void OnAction2();
  83. afx_msg void OnStore();
  84. afx_msg void OnRestore();
  85. afx_msg void OnTabSelchange(NMHDR*, LRESULT* pResult);
  86. afx_msg void OnPaint();
  87. afx_msg void OnMouseMove(UINT nFlags,CPoint point);
  88. afx_msg void OnLButtonUp(UINT nFlags,CPoint point);
  89. afx_msg void OnLButtonDown(UINT nFlags,CPoint point);
  90. afx_msg void OnRButtonUp(UINT nFlags,CPoint point);
  91. afx_msg void OnRButtonDown(UINT nFlags,CPoint point);
  92. afx_msg void OnMButtonDown(UINT nFlags,CPoint point);
  93. afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  94. afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
  95. //}}AFX_MSG
  96. DECLARE_MESSAGE_MAP();
  97. };
  98. OPENMPT_NAMESPACE_END