1
0

Childfrm.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * Childfrm.h
  3. * ----------
  4. * Purpose: Implementation of tab interface class.
  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 "PatternCursor.h"
  12. #include "../common/FileReaderFwd.h"
  13. OPENMPT_NAMESPACE_BEGIN
  14. class CModControlView;
  15. class CModControlDlg;
  16. struct GENERALVIEWSTATE
  17. {
  18. PlugParamIndex nParam = 0;
  19. CHANNELINDEX nTab = 0;
  20. PLUGINDEX nPlugin = 0;
  21. bool initialized = false;
  22. };
  23. struct PATTERNVIEWSTATE
  24. {
  25. PATTERNINDEX nPattern = 0;
  26. PatternCursor cursor = 0;
  27. PatternRect selection;
  28. PatternCursor::Columns nDetailLevel = PatternCursor::firstColumn;
  29. ORDERINDEX nOrder = 0;
  30. ORDERINDEX initialOrder = ORDERINDEX_INVALID;
  31. bool initialized = false;
  32. };
  33. struct SAMPLEVIEWSTATE
  34. {
  35. SmpLength dwScrollPos = 0;
  36. SmpLength dwBeginSel = 0;
  37. SmpLength dwEndSel = 0;
  38. SAMPLEINDEX nSample = 0;
  39. SAMPLEINDEX initialSample = 0;
  40. };
  41. struct INSTRUMENTVIEWSTATE
  42. {
  43. float zoom = 4;
  44. EnvelopeType nEnv = ENV_VOLUME;
  45. INSTRUMENTINDEX initialInstrument = 0;
  46. bool bGrid = false;
  47. bool initialized = false;
  48. };
  49. struct COMMENTVIEWSTATE
  50. {
  51. UINT nId = 0;
  52. bool initialized = false;
  53. };
  54. class CChildFrame: public CMDIChildWnd
  55. {
  56. friend class CModControlDlg;
  57. DECLARE_DYNCREATE(CChildFrame)
  58. public:
  59. CChildFrame();
  60. protected:
  61. static CChildFrame *m_lastActiveFrame;
  62. static int glMdiOpenCount;
  63. // Attributes
  64. protected:
  65. CSplitterWnd m_wndSplitter;
  66. HWND m_hWndCtrl, m_hWndView;
  67. GENERALVIEWSTATE m_ViewGeneral;
  68. PATTERNVIEWSTATE m_ViewPatterns;
  69. SAMPLEVIEWSTATE m_ViewSamples;
  70. INSTRUMENTVIEWSTATE m_ViewInstruments;
  71. COMMENTVIEWSTATE m_ViewComments;
  72. CHAR m_szCurrentViewClassName[256];
  73. bool m_bMaxWhenClosed;
  74. bool m_bInitialActivation;
  75. // Operations
  76. public:
  77. CModControlView *GetModControlView() const { return (CModControlView *)m_wndSplitter.GetPane(0, 0); }
  78. BOOL ChangeViewClass(CRuntimeClass* pNewViewClass, CCreateContext* pContext=NULL);
  79. void ForceRefresh();
  80. void SavePosition(BOOL bExit=FALSE);
  81. const char *GetCurrentViewClassName() const;
  82. LRESULT SendCtrlMessage(UINT uMsg, LPARAM lParam = 0) const;
  83. LRESULT SendViewMessage(UINT uMsg, LPARAM lParam = 0) const;
  84. LRESULT ActivateView(UINT nId, LPARAM lParam) { return ::SendMessage(m_hWndCtrl, WM_MOD_ACTIVATEVIEW, nId, lParam); }
  85. HWND GetHwndCtrl() const { return m_hWndCtrl; }
  86. HWND GetHwndView() const { return m_hWndView; }
  87. GENERALVIEWSTATE &GetGeneralViewState() { return m_ViewGeneral; }
  88. PATTERNVIEWSTATE &GetPatternViewState() { return m_ViewPatterns; }
  89. SAMPLEVIEWSTATE &GetSampleViewState() { return m_ViewSamples; }
  90. INSTRUMENTVIEWSTATE &GetInstrumentViewState() { return m_ViewInstruments; }
  91. COMMENTVIEWSTATE &GetCommentViewState() { return m_ViewComments; }
  92. void SetSplitterHeight(int x);
  93. int GetSplitterHeight();
  94. std::string SerializeView() const;
  95. void DeserializeView(FileReader &file);
  96. void ToggleViews();
  97. static CChildFrame *LastActiveFrame() { return m_lastActiveFrame; }
  98. // Overrides
  99. // ClassWizard generated virtual function overrides
  100. //{{AFX_VIRTUAL(CChildFrame)
  101. public:
  102. BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) override;
  103. BOOL PreCreateWindow(CREATESTRUCT& cs) override;
  104. void ActivateFrame(int nCmdShow) override;
  105. void OnUpdateFrameTitle(BOOL bAddToTitle) override;
  106. //}}AFX_VIRTUAL
  107. // Implementation
  108. public:
  109. virtual ~CChildFrame();
  110. // Generated message map functions
  111. protected:
  112. //{{AFX_MSG(CChildFrame)
  113. afx_msg void OnDestroy();
  114. afx_msg BOOL OnNcActivate(BOOL bActivate);
  115. afx_msg void OnMDIActivate(BOOL bActivate, CWnd *pActivateWnd, CWnd *pDeactivateWnd);
  116. afx_msg LRESULT OnChangeViewClass(WPARAM, LPARAM lParam);
  117. afx_msg LRESULT OnInstrumentSelected(WPARAM, LPARAM lParam);
  118. afx_msg BOOL OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult);
  119. //}}AFX_MSG
  120. DECLARE_MESSAGE_MAP()
  121. };
  122. /////////////////////////////////////////////////////////////////////////////
  123. //{{AFX_INSERT_LOCATION}}
  124. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  125. OPENMPT_NAMESPACE_END