TempoSwingDialog.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * TempoSwingDialog.h
  3. * ------------------
  4. * Purpose: Implementation of the tempo swing configuration 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. class CSoundFile;
  12. #include "../soundlib/Snd_defs.h"
  13. OPENMPT_NAMESPACE_BEGIN
  14. class CTempoSwingDlg: public CDialog
  15. {
  16. protected:
  17. // Scrollable container for the sliders
  18. class SliderContainer : public CStatic
  19. {
  20. public:
  21. CTempoSwingDlg &m_parent;
  22. SliderContainer(CTempoSwingDlg &parent) : m_parent(parent) { }
  23. afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar);
  24. afx_msg BOOL OnToolTipNotify(UINT, NMHDR *pNMHDR, LRESULT *);
  25. DECLARE_MESSAGE_MAP()
  26. };
  27. enum { SliderResolution = 1000, SliderUnity = SliderResolution / 2 };
  28. struct RowCtls
  29. {
  30. CStatic rowLabel, valueLabel;
  31. CSliderCtrl valueSlider;
  32. void SetValue(TempoSwing::value_type v);
  33. TempoSwing::value_type GetValue() const;
  34. };
  35. std::vector<std::unique_ptr<RowCtls>> m_controls;
  36. CButton m_checkGroup;
  37. CScrollBar m_scrollBar;
  38. SliderContainer m_container;
  39. int m_scrollPos;
  40. static int m_groupSize;
  41. public:
  42. TempoSwing m_tempoSwing;
  43. const TempoSwing m_origTempoSwing;
  44. CSoundFile &m_sndFile;
  45. PATTERNINDEX m_pattern;
  46. public:
  47. CTempoSwingDlg(CWnd *parent, const TempoSwing &currentTempoSwing, CSoundFile &sndFile, PATTERNINDEX pattern = PATTERNINDEX_INVALID);
  48. protected:
  49. virtual void DoDataExchange(CDataExchange* pDX);
  50. virtual BOOL OnInitDialog();
  51. virtual void OnOK();
  52. virtual void OnCancel();
  53. void OnClose();
  54. afx_msg void OnReset();
  55. afx_msg void OnUseGlobal();
  56. afx_msg void OnToggleGroup();
  57. afx_msg void OnGroupChanged();
  58. afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar);
  59. DECLARE_MESSAGE_MAP()
  60. };
  61. OPENMPT_NAMESPACE_END