Ctrl_ins.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /*
  2. * Ctrl_ins.h
  3. * ----------
  4. * Purpose: Instrument tab, upper panel.
  5. * Notes : (currently none)
  6. * Authors: Olivier Lapicque
  7. * OpenMPT Devs
  8. * The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
  9. */
  10. #pragma once
  11. #include "openmpt/all/BuildSettings.hpp"
  12. #include "CDecimalSupport.h"
  13. OPENMPT_NAMESPACE_BEGIN
  14. class CNoteMapWnd;
  15. class CCtrlInstruments;
  16. class CNoteMapWnd: public CStatic
  17. {
  18. protected:
  19. CModDoc &m_modDoc;
  20. CCtrlInstruments &m_pParent;
  21. UINT m_nNote = (NOTE_MIDDLEC - NOTE_MIN), m_nOldNote = 0, m_nOldIns = 0;
  22. INSTRUMENTINDEX m_nInstrument = 0;
  23. int m_cxFont = 0, m_cyFont = 0;
  24. CHANNELINDEX m_noteChannel = 0;
  25. ModCommand::NOTE m_nPlayingNote = NOTE_NONE;
  26. bool m_bIns = false;
  27. bool m_undo = true;
  28. private:
  29. void MapTranspose(int nAmount);
  30. void PrepareUndo(const char *description);
  31. public:
  32. CNoteMapWnd(CCtrlInstruments &parent, CModDoc &document)
  33. : m_modDoc(document)
  34. , m_pParent(parent)
  35. {
  36. EnableActiveAccessibility();
  37. }
  38. void SetCurrentInstrument(INSTRUMENTINDEX nIns);
  39. void SetCurrentNote(UINT nNote);
  40. void EnterNote(UINT note);
  41. bool HandleChar(WPARAM c);
  42. bool HandleNav(WPARAM k);
  43. void PlayNote(UINT note);
  44. void StopNote();
  45. void UpdateAccessibleTitle();
  46. public:
  47. //{{AFX_VIRTUAL(CNoteMapWnd)
  48. BOOL PreTranslateMessage(MSG* pMsg) override;
  49. HRESULT get_accName(VARIANT varChild, BSTR *pszName) override;
  50. //}}AFX_VIRTUAL
  51. protected:
  52. //{{AFX_MSG(CNoteMapWnd)
  53. afx_msg void OnLButtonDown(UINT, CPoint);
  54. afx_msg void OnMButtonDown(UINT flags, CPoint pt) { OnLButtonDown(flags, pt); }
  55. afx_msg void OnRButtonDown(UINT, CPoint);
  56. afx_msg void OnLButtonDblClk(UINT, CPoint);
  57. afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
  58. afx_msg void OnSetFocus(CWnd *pOldWnd);
  59. afx_msg void OnKillFocus(CWnd *pNewWnd);
  60. afx_msg BOOL OnEraseBkGnd(CDC *) { return TRUE; }
  61. afx_msg void OnPaint();
  62. afx_msg void OnMapCopySample();
  63. afx_msg void OnMapCopyNote();
  64. afx_msg void OnMapTransposeUp();
  65. afx_msg void OnMapTransposeDown();
  66. afx_msg void OnMapReset();
  67. afx_msg void OnTransposeSamples();
  68. afx_msg void OnMapRemove();
  69. afx_msg void OnEditSample(UINT nID);
  70. afx_msg void OnEditSampleMap();
  71. afx_msg void OnInstrumentDuplicate();
  72. afx_msg LRESULT OnCustomKeyMsg(WPARAM, LPARAM); //rewbs.customKeys
  73. //}}AFX_MSG
  74. DECLARE_MESSAGE_MAP()
  75. };
  76. class CCtrlInstruments: public CModControlDlg
  77. {
  78. protected:
  79. CModControlBar m_ToolBar;
  80. CSpinButtonCtrl m_SpinInstrument, m_SpinFadeOut, m_SpinGlobalVol, m_SpinPanning;
  81. CSpinButtonCtrl m_SpinMidiPR, m_SpinPPS, m_SpinMidiBK, m_SpinPWD;
  82. CComboBox m_ComboNNA, m_ComboDCT, m_ComboDCA, m_ComboPPC, m_CbnMidiCh, m_CbnMixPlug, m_CbnResampling, m_CbnFilterMode, m_CbnPluginVolumeHandling;
  83. CEdit m_EditName, m_EditFileName, m_EditGlobalVol, m_EditPanning, m_EditFadeOut;
  84. CNumberEdit m_EditPPS, m_EditPWD;
  85. CButton m_CheckPanning, m_CheckCutOff, m_CheckResonance, velocityStyle;
  86. CSliderCtrl m_SliderVolSwing, m_SliderPanSwing, m_SliderCutSwing, m_SliderResSwing, m_SliderCutOff, m_SliderResonance;
  87. CNoteMapWnd m_NoteMap;
  88. CSliderCtrl m_SliderAttack;
  89. CSpinButtonCtrl m_SpinAttack;
  90. //Tuning
  91. CComboBox m_ComboTuning;
  92. // Pitch/Tempo lock
  93. CNumberEdit m_EditPitchTempoLock;
  94. CButton m_CheckPitchTempoLock;
  95. INSTRUMENTINDEX m_nInstrument = 1;
  96. bool m_openendPluginListWithMouse = false;
  97. bool m_startedHScroll = false;
  98. bool m_startedEdit = false;
  99. void UpdateTuningComboBox();
  100. void BuildTuningComboBox();
  101. void UpdatePluginList();
  102. public:
  103. CCtrlInstruments(CModControlView &parent, CModDoc &document);
  104. public:
  105. void SetModified(InstrumentHint hint, bool updateAll);
  106. BOOL SetCurrentInstrument(UINT nIns, BOOL bUpdNum=TRUE);
  107. bool InsertInstrument(bool duplicate);
  108. bool OpenInstrument(const mpt::PathString &fileName);
  109. bool OpenInstrument(const CSoundFile &sndFile, INSTRUMENTINDEX nInstr);
  110. void SaveInstrument(bool doBatchSave);
  111. BOOL EditSample(UINT nSample);
  112. void UpdateFilterText();
  113. Setting<LONG> &GetSplitPosRef() override {return TrackerSettings::Instance().glInstrumentWindowHeight;}
  114. public:
  115. //{{AFX_VIRTUAL(CCtrlInstruments)
  116. BOOL OnInitDialog() override;
  117. void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support
  118. CRuntimeClass *GetAssociatedViewClass() override;
  119. void RecalcLayout() override;
  120. void OnActivatePage(LPARAM) override;
  121. void OnDeactivatePage() override;
  122. void UpdateView(UpdateHint hint, CObject *pObj = nullptr) override;
  123. LRESULT OnModCtrlMsg(WPARAM wParam, LPARAM lParam) override;
  124. BOOL GetToolTipText(UINT uId, LPTSTR pszText) override;
  125. BOOL PreTranslateMessage(MSG* pMsg) override;
  126. //}}AFX_VIRTUAL
  127. protected:
  128. void PrepareUndo(const char *description);
  129. //{{AFX_MSG(CCtrlInstruments)
  130. afx_msg void OnEditFocus();
  131. afx_msg void OnVScroll(UINT nCode, UINT nPos, CScrollBar *pSB);
  132. afx_msg void OnHScroll(UINT nCode, UINT nPos, CScrollBar *pSB);
  133. afx_msg void OnTbnDropDownToolBar(NMHDR* pNMHDR, LRESULT* pResult);
  134. afx_msg void OnInstrumentChanged();
  135. afx_msg void OnPrevInstrument();
  136. afx_msg void OnNextInstrument();
  137. afx_msg void OnInstrumentNew();
  138. afx_msg void OnInstrumentDuplicate() { InsertInstrument(true); }
  139. afx_msg void OnInstrumentOpen();
  140. afx_msg void OnInstrumentSave();
  141. afx_msg void OnInstrumentSaveOne() { SaveInstrument(false); }
  142. afx_msg void OnInstrumentSaveAll() { SaveInstrument(true); }
  143. afx_msg void OnInstrumentPlay();
  144. afx_msg void OnNameChanged();
  145. afx_msg void OnFileNameChanged();
  146. afx_msg void OnFadeOutVolChanged();
  147. afx_msg void OnGlobalVolChanged();
  148. afx_msg void OnSetPanningChanged();
  149. afx_msg void OnPanningChanged();
  150. afx_msg void OnNNAChanged();
  151. afx_msg void OnDCTChanged();
  152. afx_msg void OnDCAChanged();
  153. afx_msg void OnMPRChanged();
  154. afx_msg void OnMPRKillFocus();
  155. afx_msg void OnMBKChanged();
  156. afx_msg void OnMCHChanged();
  157. afx_msg void OnResamplingChanged();
  158. afx_msg void OnMixPlugChanged();
  159. afx_msg void OnPPSChanged();
  160. afx_msg void OnPPCChanged();
  161. afx_msg void OnFilterModeChanged();
  162. afx_msg void OnPluginVelocityHandlingChanged();
  163. afx_msg void OnPluginVolumeHandlingChanged();
  164. afx_msg void OnPitchWheelDepthChanged();
  165. afx_msg void OnOpenPluginList() { m_openendPluginListWithMouse = true; }
  166. afx_msg void OnAttackChanged();
  167. afx_msg void OnEnableCutOff();
  168. afx_msg void OnEnableResonance();
  169. afx_msg void OnEditSampleMap();
  170. afx_msg void TogglePluginEditor();
  171. afx_msg LRESULT OnCustomKeyMsg(WPARAM, LPARAM);
  172. afx_msg void OnCbnSelchangeCombotuning();
  173. afx_msg void OnEnChangeEditPitchTempoLock();
  174. afx_msg void OnBnClickedCheckPitchtempolock();
  175. afx_msg void OnEnKillFocusEditPitchTempoLock();
  176. afx_msg void OnEnKillFocusEditFadeOut();
  177. afx_msg void OnXButtonUp(UINT nFlags, UINT nButton, CPoint point);
  178. //}}AFX_MSG
  179. DECLARE_MESSAGE_MAP()
  180. };
  181. OPENMPT_NAMESPACE_END