1
0

EffectVis.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * EffectVis.h
  3. * -----------
  4. * Purpose: Implementation of parameter visualisation 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 "EffectInfo.h"
  12. OPENMPT_NAMESPACE_BEGIN
  13. class CViewPattern;
  14. class CModDoc;
  15. class CSoundFile;
  16. #define FXVSTATUS_LDRAGGING 0x01
  17. #define FXVSTATUS_RDRAGGING 0x02
  18. // EffectVis dialog
  19. class CEffectVis : public CDialog
  20. {
  21. DECLARE_DYNAMIC(CEffectVis)
  22. public:
  23. enum EditAction
  24. {
  25. kAction_OverwriteFX,
  26. kAction_OverwriteFXWithNote,
  27. kAction_FillFX,
  28. kAction_OverwritePC,
  29. kAction_FillPC,
  30. kAction_Preserve
  31. };
  32. CEffectVis(CViewPattern *pViewPattern, ROWINDEX startRow, ROWINDEX endRow, CHANNELINDEX nchn, CModDoc &modDoc, PATTERNINDEX pat);
  33. void UpdateSelection(ROWINDEX startRow, ROWINDEX endRow, CHANNELINDEX nchn, PATTERNINDEX pat);
  34. void Update();
  35. void OpenEditor(CWnd *parent);
  36. void SetPlayCursor(PATTERNINDEX nPat, ROWINDEX nRow);
  37. void DoClose();
  38. afx_msg void OnSize(UINT nType, int cx, int cy);
  39. protected:
  40. void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support
  41. void PostNcDestroy() override;
  42. EffectInfo effectInfo;
  43. CBitmap m_bGrid, m_bNodes, m_bPlayPos;
  44. HBITMAP m_pbOldGrid = nullptr, m_pbOldNodes = nullptr, m_pbOldPlayPos = nullptr;
  45. CDC m_dcGrid, m_dcNodes, m_dcPlayPos;
  46. void DrawNodes();
  47. void DrawGrid();
  48. void ShowVis(CDC *pDC);
  49. void ShowVisImage(CDC *pDC);
  50. RECT invalidated;
  51. ROWINDEX m_nLastDrawnRow = ROWINDEX_INVALID; // for interpolation
  52. int m_nLastDrawnY = -1; // for interpolation
  53. int m_nRowToErase = -1;
  54. int m_nParamToErase = -1;
  55. int m_nodeSizeHalf; // Half width of a node;
  56. int m_marginBottom;
  57. int m_innerBorder;
  58. ROWINDEX m_nOldPlayPos = ROWINDEX_INVALID;
  59. ModCommand m_templatePCNote;
  60. protected:
  61. ROWINDEX m_startRow;
  62. ROWINDEX m_endRow;
  63. ROWINDEX m_nRows;
  64. CHANNELINDEX m_nChan;
  65. PATTERNINDEX m_nPattern;
  66. int m_nFillEffect;
  67. static EditAction m_nAction;
  68. int m_nDragItem = -1;
  69. UINT m_nBtnMouseOver;
  70. DWORD m_dwStatus = 0;
  71. float m_pixelsPerRow = 1, m_pixelsPerFXParam = 1, m_pixelsPerPCParam = 1;
  72. bool m_forceRedraw = true;
  73. void InvalidateRow(int row);
  74. int RowToScreenX(ROWINDEX row) const;
  75. int RowToScreenY(ROWINDEX row) const;
  76. int PCParamToScreenY(uint16 param) const;
  77. int FXParamToScreenY(uint16 param) const;
  78. uint16 GetParam(ROWINDEX row) const;
  79. EffectCommand GetCommand(ROWINDEX row) const;
  80. void SetParamFromY(ROWINDEX row, int y);
  81. void SetCommand(ROWINDEX row, EffectCommand cmd);
  82. ModCommand::PARAM ScreenYToFXParam(int y) const;
  83. uint16 ScreenYToPCParam(int y) const;
  84. ROWINDEX ScreenXToRow(int x) const;
  85. bool IsPcNote(ROWINDEX row) const;
  86. void SetPcNote(ROWINDEX row);
  87. CModDoc &m_ModDoc;
  88. CSoundFile &m_SndFile;
  89. CRect m_rcDraw;
  90. CRect m_rcFullWin;
  91. CComboBox m_cmbEffectList, m_cmbActionList;
  92. CEdit m_edVisStatus;
  93. void OnOK() override;
  94. void OnCancel() override;
  95. afx_msg void OnClose();
  96. CViewPattern *m_pViewPattern;
  97. DECLARE_MESSAGE_MAP()
  98. BOOL OnInitDialog() override;
  99. afx_msg void OnPaint();
  100. protected:
  101. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  102. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  103. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  104. afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
  105. afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
  106. afx_msg void OnEffectChanged();
  107. afx_msg void OnActionChanged();
  108. afx_msg BOOL OnEraseBkgnd(CDC *) { return TRUE; }
  109. void MakeChange(ROWINDEX currentRow, int newY);
  110. };
  111. OPENMPT_NAMESPACE_END