DefaultVstEditor.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * DefaultVstEditor.h
  3. * ------------------
  4. * Purpose: Implementation of the default plugin editor that is used if a plugin does not provide an own editor GUI.
  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. #ifndef NO_PLUGINS
  12. #include "Mptrack.h"
  13. #include "AbstractVstEditor.h"
  14. OPENMPT_NAMESPACE_BEGIN
  15. enum
  16. {
  17. PARAM_RESOLUTION = 1000,
  18. NUM_PLUGINEDITOR_PARAMETERS = 8, // Parameters on screen
  19. };
  20. struct Measurements;
  21. class ParamControlSet
  22. {
  23. protected:
  24. CSliderCtrl valueSlider;
  25. CEdit valueEdit;
  26. CStatic nameLabel;
  27. CStatic valueLabel;
  28. CStatic perMilLabel;
  29. public:
  30. ParamControlSet(CWnd *parent, const CRect &rect, int setID, const Measurements &m);
  31. ~ParamControlSet();
  32. void EnableControls(bool enable = true);
  33. void ResetContent();
  34. void SetParamName(const CString &name);
  35. void SetParamValue(int value, const CString &text);
  36. int GetParamValueFromSlider() const;
  37. int GetParamValueFromEdit() const;
  38. int GetSliderID() const { return valueSlider.GetDlgCtrlID(); };
  39. };
  40. class CDefaultVstEditor : public CAbstractVstEditor
  41. {
  42. protected:
  43. std::vector<ParamControlSet *> controls;
  44. CScrollBar paramScroller;
  45. PlugParamIndex paramOffset;
  46. int m_nControlLock;
  47. public:
  48. CDefaultVstEditor(IMixPlugin &plugin);
  49. virtual ~CDefaultVstEditor();
  50. virtual void UpdateParamDisplays() { CAbstractVstEditor::UpdateParamDisplays(); UpdateControls(false); };
  51. virtual bool OpenEditor(CWnd *parent);
  52. // Plugins may not request to change the GUI size, since we use our own GUI.
  53. virtual bool IsResizable() const { return false; };
  54. virtual bool SetSize(int, int) { return false; };
  55. protected:
  56. virtual void DoDataExchange(CDataExchange* pDX);
  57. DECLARE_MESSAGE_MAP()
  58. afx_msg void OnParamTextboxChanged(UINT id);
  59. afx_msg void OnParamSliderChanged(UINT id);
  60. afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  61. afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  62. afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
  63. protected:
  64. void CreateControls();
  65. void UpdateControls(bool updateParamNames);
  66. void SetParam(PlugParamIndex param, int value);
  67. void UpdateParamDisplay(PlugParamIndex param);
  68. };
  69. OPENMPT_NAMESPACE_END
  70. #endif // NO_PLUGINS