Mainfrm.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. /*
  2. * Mainfrm.h
  3. * ---------
  4. * Purpose: Implementation of OpenMPT's main window code.
  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 <Msctf.h>
  12. #include "Mptrack.h"
  13. #include "AutoSaver.h"
  14. #include "UpdateHints.h"
  15. #include "../soundlib/AudioCriticalSection.h"
  16. #include "mpt/mutex/mutex.hpp"
  17. #include "../soundlib/Sndfile.h"
  18. #include "openmpt/soundbase/Dither.hpp"
  19. #include "../common/Dither.h"
  20. #include "mpt/audio/span.hpp"
  21. #include "openmpt/sounddevice/SoundDeviceBuffer.hpp"
  22. OPENMPT_NAMESPACE_BEGIN
  23. class CDLSBank;
  24. class CInputHandler;
  25. class CModDoc;
  26. class CAutoSaver;
  27. struct UpdateCheckResult;
  28. namespace SoundDevice {
  29. class Base;
  30. class ICallback;
  31. } // namerspace SoundDevice
  32. #define MAINFRAME_TITLE _T("Open ModPlug Tracker")
  33. // Custom window messages
  34. enum
  35. {
  36. WM_MOD_UPDATEPOSITION = (WM_USER+1973),
  37. WM_MOD_INVALIDATEPATTERNS,
  38. WM_MOD_ACTIVATEVIEW,
  39. WM_MOD_CHANGEVIEWCLASS,
  40. WM_MOD_UNLOCKCONTROLS,
  41. WM_MOD_CTRLMSG,
  42. WM_MOD_VIEWMSG,
  43. WM_MOD_MIDIMSG,
  44. WM_MOD_GETTOOLTIPTEXT,
  45. WM_MOD_DRAGONDROPPING,
  46. WM_MOD_KBDNOTIFY,
  47. WM_MOD_INSTRSELECTED,
  48. WM_MOD_KEYCOMMAND,
  49. WM_MOD_RECORDPARAM,
  50. WM_MOD_PLUGPARAMAUTOMATE,
  51. WM_MOD_MIDIMAPPING,
  52. WM_MOD_UPDATEVIEWS,
  53. WM_MOD_SETMODIFIED,
  54. WM_MOD_MDIACTIVATE,
  55. WM_MOD_MDIDEACTIVATE,
  56. WM_MOD_UPDATENOTIFY,
  57. WM_MOD_PLUGINDRYWETRATIOCHANGED,
  58. };
  59. enum
  60. {
  61. MPT_WM_APP_UPDATECHECK_START = WM_APP + 1,
  62. MPT_WM_APP_UPDATECHECK_PROGRESS = WM_APP + 2,
  63. MPT_WM_APP_UPDATECHECK_CANCELED = WM_APP + 3,
  64. MPT_WM_APP_UPDATECHECK_FAILURE = WM_APP + 4,
  65. MPT_WM_APP_UPDATECHECK_SUCCESS = WM_APP + 5,
  66. };
  67. enum
  68. {
  69. CTRLMSG_BASE = 0,
  70. CTRLMSG_SETVIEWWND,
  71. CTRLMSG_ACTIVATEPAGE,
  72. CTRLMSG_DEACTIVATEPAGE,
  73. CTRLMSG_SETFOCUS,
  74. // Pattern-Specific
  75. CTRLMSG_GETCURRENTPATTERN,
  76. CTRLMSG_NOTIFYCURRENTORDER,
  77. CTRLMSG_SETCURRENTORDER,
  78. CTRLMSG_GETCURRENTORDER,
  79. CTRLMSG_FORCEREFRESH,
  80. CTRLMSG_PAT_PREVINSTRUMENT,
  81. CTRLMSG_PAT_NEXTINSTRUMENT,
  82. CTRLMSG_PAT_SETINSTRUMENT,
  83. CTRLMSG_PAT_FOLLOWSONG,
  84. CTRLMSG_PAT_LOOP,
  85. CTRLMSG_PAT_NEWPATTERN,
  86. CTRLMSG_PAT_SETSEQUENCE,
  87. CTRLMSG_GETCURRENTINSTRUMENT,
  88. CTRLMSG_SETCURRENTINSTRUMENT,
  89. CTRLMSG_SETSPACING,
  90. CTRLMSG_PATTERNCHANGED,
  91. CTRLMSG_PREVORDER,
  92. CTRLMSG_NEXTORDER,
  93. CTRLMSG_SETRECORD,
  94. CTRLMSG_PAT_DUPPATTERN,
  95. // Sample-Specific
  96. CTRLMSG_SMP_PREVINSTRUMENT,
  97. CTRLMSG_SMP_NEXTINSTRUMENT,
  98. CTRLMSG_SMP_OPENFILE,
  99. CTRLMSG_SMP_SETZOOM,
  100. CTRLMSG_SMP_GETZOOM,
  101. CTRLMSG_SMP_SONGDROP,
  102. CTRLMSG_SMP_INITOPL,
  103. CTRLMSG_SMP_NEWSAMPLE,
  104. // Instrument-Specific
  105. CTRLMSG_INS_PREVINSTRUMENT,
  106. CTRLMSG_INS_NEXTINSTRUMENT,
  107. CTRLMSG_INS_OPENFILE,
  108. CTRLMSG_INS_NEWINSTRUMENT,
  109. CTRLMSG_INS_SONGDROP,
  110. CTRLMSG_INS_SAMPLEMAP,
  111. };
  112. enum
  113. {
  114. VIEWMSG_BASE=0,
  115. VIEWMSG_SETCTRLWND,
  116. VIEWMSG_SETACTIVE,
  117. VIEWMSG_SETFOCUS,
  118. VIEWMSG_SAVESTATE,
  119. VIEWMSG_LOADSTATE,
  120. // Pattern-Specific
  121. VIEWMSG_SETCURRENTPATTERN,
  122. VIEWMSG_GETCURRENTPATTERN,
  123. VIEWMSG_FOLLOWSONG,
  124. VIEWMSG_PATTERNLOOP,
  125. VIEWMSG_GETCURRENTPOS,
  126. VIEWMSG_SETRECORD,
  127. VIEWMSG_SETSPACING,
  128. VIEWMSG_PATTERNPROPERTIES,
  129. VIEWMSG_SETVUMETERS,
  130. VIEWMSG_SETPLUGINNAMES, //rewbs.patPlugNames
  131. VIEWMSG_DOMIDISPACING,
  132. VIEWMSG_EXPANDPATTERN,
  133. VIEWMSG_SHRINKPATTERN,
  134. VIEWMSG_COPYPATTERN,
  135. VIEWMSG_PASTEPATTERN,
  136. VIEWMSG_AMPLIFYPATTERN,
  137. VIEWMSG_SETDETAIL,
  138. // Sample-Specific
  139. VIEWMSG_SETCURRENTSAMPLE,
  140. VIEWMSG_SETMODIFIED,
  141. VIEWMSG_PREPAREUNDO,
  142. // Instrument-Specific
  143. VIEWMSG_SETCURRENTINSTRUMENT,
  144. VIEWMSG_DOSCROLL,
  145. };
  146. #define NUM_VUMETER_PENS 32
  147. // Tab Order
  148. enum OptionsPage
  149. {
  150. OPTIONS_PAGE_DEFAULT = 0,
  151. OPTIONS_PAGE_GENERAL = OPTIONS_PAGE_DEFAULT,
  152. OPTIONS_PAGE_SOUNDCARD,
  153. OPTIONS_PAGE_MIXER,
  154. OPTIONS_PAGE_PLAYER,
  155. OPTIONS_PAGE_SAMPLEDITOR,
  156. OPTIONS_PAGE_KEYBOARD,
  157. OPTIONS_PAGE_COLORS,
  158. OPTIONS_PAGE_MIDI,
  159. OPTIONS_PAGE_PATHS,
  160. OPTIONS_PAGE_UPDATE,
  161. OPTIONS_PAGE_ADVANCED,
  162. OPTIONS_PAGE_WINE,
  163. };
  164. /////////////////////////////////////////////////////////////////////////
  165. // Player position notification
  166. #define MAX_UPDATE_HISTORY 2000 // 2 seconds with 1 ms updates
  167. OPENMPT_NAMESPACE_END
  168. #include "Notification.h"
  169. OPENMPT_NAMESPACE_BEGIN
  170. OPENMPT_NAMESPACE_END
  171. #include "CImageListEx.h"
  172. #include "Mainbar.h"
  173. #include "TrackerSettings.h"
  174. OPENMPT_NAMESPACE_BEGIN
  175. struct MODPLUGDIB;
  176. template<> inline SettingValue ToSettingValue(const WINDOWPLACEMENT &val)
  177. {
  178. return SettingValue(EncodeBinarySetting<WINDOWPLACEMENT>(val), "WINDOWPLACEMENT");
  179. }
  180. template<> inline WINDOWPLACEMENT FromSettingValue(const SettingValue &val)
  181. {
  182. ASSERT(val.GetTypeTag() == "WINDOWPLACEMENT");
  183. return DecodeBinarySetting<WINDOWPLACEMENT>(val.as<std::vector<std::byte> >());
  184. }
  185. class VUMeter
  186. : public IMonitorInput
  187. , public IMonitorOutput
  188. {
  189. public:
  190. static constexpr std::size_t maxChannels = 4;
  191. static const float dynamicRange; // corresponds to the current implementation of the UI widget diplaying the result
  192. struct Channel
  193. {
  194. int32 peak = 0;
  195. bool clipped = false;
  196. };
  197. private:
  198. Channel channels[maxChannels];
  199. int32 decayParam;
  200. void Process(Channel &channel, MixSampleInt sample);
  201. void Process(Channel &channel, MixSampleFloat sample);
  202. public:
  203. VUMeter() : decayParam(0) { SetDecaySpeedDecibelPerSecond(88.0f); }
  204. void SetDecaySpeedDecibelPerSecond(float decibelPerSecond);
  205. public:
  206. const Channel & operator [] (std::size_t channel) const { return channels[channel]; }
  207. void Process(mpt::audio_span_interleaved<const MixSampleInt> buffer);
  208. void Process(mpt::audio_span_planar<const MixSampleInt> buffer);
  209. void Process(mpt::audio_span_interleaved<const MixSampleFloat> buffer);
  210. void Process(mpt::audio_span_planar<const MixSampleFloat> buffer);
  211. void Decay(int32 secondsNum, int32 secondsDen);
  212. void ResetClipped();
  213. };
  214. class TfLanguageProfileNotifySink : public ITfLanguageProfileNotifySink
  215. {
  216. public:
  217. TfLanguageProfileNotifySink();
  218. ~TfLanguageProfileNotifySink();
  219. HRESULT STDMETHODCALLTYPE OnLanguageChange(LANGID langid, __RPC__out BOOL *pfAccept) override;
  220. HRESULT STDMETHODCALLTYPE OnLanguageChanged() override;
  221. HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject) override;
  222. ULONG STDMETHODCALLTYPE AddRef() override;
  223. ULONG STDMETHODCALLTYPE Release() override;
  224. protected:
  225. ITfInputProcessorProfiles *m_pProfiles = nullptr;
  226. ITfSource *m_pSource = nullptr;
  227. DWORD m_dwCookie = TF_INVALID_COOKIE;
  228. };
  229. class CMainFrame
  230. : public CMDIFrameWnd
  231. , public SoundDevice::CallbackBufferHandler<DithersOpenMPT>
  232. , public SoundDevice::IMessageReceiver
  233. , public TfLanguageProfileNotifySink
  234. {
  235. DECLARE_DYNAMIC(CMainFrame)
  236. // static data
  237. public:
  238. // Globals
  239. static OptionsPage m_nLastOptionsPage;
  240. static HHOOK ghKbdHook;
  241. // GDI
  242. static HICON m_hIcon;
  243. static HFONT m_hGUIFont, m_hFixedFont;
  244. static HPEN penDarkGray, penHalfDarkGray, penGray99;
  245. static HCURSOR curDragging, curNoDrop, curArrow, curNoDrop2, curVSplit;
  246. static MODPLUGDIB *bmpNotes, *bmpVUMeters, *bmpPluginVUMeters;
  247. static COLORREF gcolrefVuMeter[NUM_VUMETER_PENS * 2]; // General tab VU meters
  248. public:
  249. // Low-Level Audio
  250. CriticalSection m_SoundDeviceFillBufferCriticalSection;
  251. Util::MultimediaClock m_SoundDeviceClock;
  252. SoundDevice::IBase *gpSoundDevice = nullptr;
  253. UINT_PTR m_NotifyTimer = 0;
  254. VUMeter m_VUMeterInput;
  255. VUMeter m_VUMeterOutput;
  256. DWORD m_AudioThreadId = 0;
  257. bool m_InNotifyHandler = false;
  258. // Midi Input
  259. public:
  260. static HMIDIIN shMidiIn;
  261. public:
  262. CImageListEx m_MiscIcons, m_MiscIconsDisabled; // Misc Icons
  263. CImageListEx m_PatternIcons, m_PatternIconsDisabled; // Pattern icons (includes some from sample editor as well...)
  264. CImageListEx m_EnvelopeIcons; // Instrument editor icons
  265. CImageListEx m_SampleIcons; // Sample editor icons
  266. protected:
  267. CModTreeBar m_wndTree;
  268. CStatusBar m_wndStatusBar;
  269. CMainToolBar m_wndToolBar;
  270. CSoundFile *m_pSndFile = nullptr; // != NULL only when currently playing or rendering
  271. HWND m_hWndMidi = nullptr;
  272. CSoundFile::samplecount_t m_dwTimeSec = 0;
  273. UINT_PTR m_nTimer = 0;
  274. UINT m_nAvgMixChn = 0, m_nMixChn = 0;
  275. // Misc
  276. class COptionsSoundcard *m_SoundCardOptionsDialog = nullptr;
  277. #if defined(MPT_ENABLE_UPDATE)
  278. class CUpdateSetupDlg *m_UpdateOptionsDialog = nullptr;
  279. std::unique_ptr<UpdateCheckResult> m_updateCheckResult;
  280. #endif // MPT_ENABLE_UPDATE
  281. DWORD helpCookie = 0;
  282. bool m_bOptionsLocked = false;
  283. // Notification Buffer
  284. mpt::mutex m_NotificationBufferMutex; // to avoid deadlocks, this mutex should only be taken as a innermost lock, i.e. do not block on anything while holding this mutex
  285. Util::fixed_size_queue<Notification,MAX_UPDATE_HISTORY> m_NotifyBuffer;
  286. // Instrument preview in tree view
  287. CSoundFile m_WaveFile;
  288. TCHAR m_szUserText[512], m_szInfoText[512], m_szXInfoText[512];
  289. CAutoSaver m_AutoSaver;
  290. public:
  291. CWnd *m_pNoteMapHasFocus = nullptr;
  292. CWnd *m_pOrderlistHasFocus = nullptr;
  293. bool m_bModTreeHasFocus = false;
  294. public:
  295. CMainFrame(/*CString regKeyExtension*/);
  296. void Initialize();
  297. // Low-Level Audio
  298. public:
  299. static void UpdateDspEffects(CSoundFile &sndFile, bool reset=false);
  300. static void UpdateAudioParameters(CSoundFile &sndFile, bool reset=false);
  301. // from SoundDevice::IBufferHandler
  302. uint64 SoundCallbackGetReferenceClockNowNanoseconds() const override;
  303. void SoundCallbackPreStart() override;
  304. void SoundCallbackPostStop() override;
  305. bool SoundCallbackIsLockedByCurrentThread() const override;
  306. void SoundCallbackLock() override;
  307. uint64 SoundCallbackLockedGetReferenceClockNowNanoseconds() const override;
  308. void SoundCallbackLockedProcessPrepare(SoundDevice::TimeInfo timeInfo) override;
  309. void SoundCallbackLockedCallback(SoundDevice::CallbackBuffer<DithersOpenMPT> &buffer) override;
  310. void SoundCallbackLockedProcessDone(SoundDevice::TimeInfo timeInfo) override;
  311. void SoundCallbackUnlock() override;
  312. // from SoundDevice::IMessageReceiver
  313. void SoundDeviceMessage(LogLevel level, const mpt::ustring &str) override;
  314. bool InGuiThread() const { return theApp.InGuiThread(); }
  315. bool InAudioThread() const { return GetCurrentThreadId() == m_AudioThreadId; }
  316. bool InNotifyHandler() const { return m_InNotifyHandler; }
  317. bool audioOpenDevice();
  318. void audioCloseDevice();
  319. bool IsAudioDeviceOpen() const;
  320. bool DoNotification(DWORD dwSamplesRead, int64 streamPosition);
  321. // Midi Input Functions
  322. public:
  323. bool midiOpenDevice(bool showSettings = true);
  324. void midiCloseDevice();
  325. void SetMidiRecordWnd(HWND hwnd) { m_hWndMidi = hwnd; }
  326. HWND GetMidiRecordWnd() const { return m_hWndMidi; }
  327. static int ApplyVolumeRelatedSettings(const DWORD &dwParam1, const BYTE midivolume);
  328. // static functions
  329. public:
  330. static CMainFrame *GetMainFrame() { return (CMainFrame *)theApp.m_pMainWnd; }
  331. static void UpdateColors();
  332. static HICON GetModIcon() { return m_hIcon; }
  333. static HFONT GetGUIFont() { return m_hGUIFont; }
  334. static HFONT &GetCommentsFont() { return m_hFixedFont; }
  335. static void UpdateAllViews(UpdateHint hint, CObject *pHint=NULL);
  336. static LRESULT CALLBACK KeyboardProc(int code, WPARAM wParam, LPARAM lParam);
  337. static CInputHandler *m_InputHandler;
  338. // Misc functions
  339. public:
  340. void SetUserText(LPCTSTR lpszText);
  341. void SetInfoText(LPCTSTR lpszText);
  342. void SetXInfoText(LPCTSTR lpszText);
  343. void SetHelpText(LPCTSTR lpszText);
  344. UINT GetBaseOctave() const;
  345. CModDoc *GetActiveDoc() const;
  346. CView *GetActiveView() const;
  347. void OnDocumentCreated(CModDoc *pModDoc);
  348. void OnDocumentClosed(CModDoc *pModDoc);
  349. void UpdateTree(CModDoc *pModDoc, UpdateHint hint, CObject *pHint = nullptr);
  350. void RefreshDlsBanks();
  351. static CInputHandler* GetInputHandler() { return m_InputHandler; }
  352. void SetElapsedTime(double t) { m_dwTimeSec = static_cast<CSoundFile::samplecount_t>(t); }
  353. #if defined(MPT_ENABLE_UPDATE)
  354. bool ShowUpdateIndicator(const UpdateCheckResult &result, const CString &releaseVersion, const CString &infoURL, bool showHighlight);
  355. #endif // MPT_ENABLE_UPDATE
  356. CModTree *GetUpperTreeview() { return m_wndTree.m_pModTree; }
  357. CModTree *GetLowerTreeview() { return m_wndTree.m_pModTreeData; }
  358. bool SetTreeSoundfile(FileReader &file) { return m_wndTree.SetTreeSoundfile(file); }
  359. void CreateExampleModulesMenu();
  360. void CreateTemplateModulesMenu();
  361. CMenu *GetFileMenu() const;
  362. // Creates submenu whose items are filenames of files in both
  363. // AppDirectory\folderName\ (usually C:\Program Files\OpenMPT\folderName\)
  364. // and
  365. // ConfigDirectory\folderName (usually %appdata%\OpenMPT\folderName\)
  366. // [in] maxCount: Maximum number of items allowed in the menu
  367. // [out] paths: Receives the full paths of the files added to the menu.
  368. // [in] folderName: Name of the folder
  369. // [in] idRangeBegin: First ID for the menu item.
  370. static HMENU CreateFileMenu(const size_t maxCount, std::vector<mpt::PathString>& paths, const mpt::PathString &folderName, const uint16 idRangeBegin);
  371. // Player functions
  372. public:
  373. // High-level synchronous playback functions, do not hold AudioCriticalSection while calling these
  374. bool PreparePlayback();
  375. bool StartPlayback();
  376. void StopPlayback();
  377. bool RestartPlayback();
  378. bool PausePlayback();
  379. static bool IsValidSoundFile(CSoundFile &sndFile) { return sndFile.GetType() ? true : false; }
  380. static bool IsValidSoundFile(CSoundFile *pSndFile) { return pSndFile && pSndFile->GetType(); }
  381. void SetPlaybackSoundFile(CSoundFile *pSndFile);
  382. void UnsetPlaybackSoundFile();
  383. void GenerateStopNotification();
  384. bool PlayMod(CModDoc *);
  385. bool StopMod(CModDoc *pDoc = nullptr);
  386. bool PauseMod(CModDoc *pDoc = nullptr);
  387. bool StopSoundFile(CSoundFile *);
  388. bool PlaySoundFile(CSoundFile *);
  389. bool PlaySoundFile(const mpt::PathString &filename, ModCommand::NOTE note, int volume = -1);
  390. bool PlaySoundFile(CSoundFile &sndFile, INSTRUMENTINDEX nInstrument, SAMPLEINDEX nSample, ModCommand::NOTE note, int volume = -1);
  391. bool PlayDLSInstrument(const CDLSBank &bank, UINT instr, UINT region, ModCommand::NOTE note, int volume = -1);
  392. void InitPreview();
  393. void PreparePreview(ModCommand::NOTE note, int volume);
  394. void StopPreview() { StopSoundFile(&m_WaveFile); }
  395. void PlayPreview() { PlaySoundFile(&m_WaveFile); }
  396. inline bool IsPlaying() const { return m_pSndFile != nullptr; }
  397. // Return currently playing module (nullptr if none is playing)
  398. inline CModDoc *GetModPlaying() const { return m_pSndFile ? m_pSndFile->GetpModDoc() : nullptr; }
  399. // Return currently playing module (nullptr if none is playing)
  400. inline CSoundFile *GetSoundFilePlaying() const { return m_pSndFile; }
  401. BOOL InitRenderer(CSoundFile*);
  402. BOOL StopRenderer(CSoundFile*);
  403. void SwitchToActiveView();
  404. void IdleHandlerSounddevice();
  405. BOOL ResetSoundCard();
  406. BOOL SetupSoundCard(SoundDevice::Settings deviceSettings, SoundDevice::Identifier deviceIdentifier, SoundDeviceStopMode stoppedMode, bool forceReset = false);
  407. BOOL SetupMiscOptions();
  408. BOOL SetupPlayer();
  409. void SetupMidi(DWORD d, UINT n);
  410. HWND GetFollowSong() const;
  411. HWND GetFollowSong(const CModDoc *pDoc) const { return (pDoc == GetModPlaying()) ? GetFollowSong() : nullptr; }
  412. void ResetNotificationBuffer();
  413. // Notify accessbility software that it should read out updated UI elements
  414. void NotifyAccessibilityUpdate(CWnd &source);
  415. // Overrides
  416. protected:
  417. // ClassWizard generated virtual function overrides
  418. //{{AFX_VIRTUAL(CMainFrame)
  419. BOOL PreCreateWindow(CREATESTRUCT& cs) override;
  420. BOOL PreTranslateMessage(MSG *pMsg) override;
  421. BOOL DestroyWindow() override;
  422. void OnUpdateFrameTitle(BOOL bAddToTitle) override;
  423. //}}AFX_VIRTUAL
  424. /// Opens either template or example menu item.
  425. void OpenMenuItemFile(const UINT nId, const bool isTemplateFile);
  426. public:
  427. void UpdateMRUList();
  428. // Implementation
  429. public:
  430. ~CMainFrame() override;
  431. #ifdef _DEBUG
  432. void AssertValid() const override;
  433. void Dump(CDumpContext& dc) const override;
  434. #endif
  435. void OnTimerGUI();
  436. void OnTimerNotify();
  437. // Message map functions
  438. //{{AFX_MSG(CMainFrame)
  439. public:
  440. afx_msg void OnAddDlsBank();
  441. afx_msg void OnImportMidiLib();
  442. afx_msg void OnViewOptions();
  443. protected:
  444. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  445. afx_msg void OnRButtonDown(UINT, CPoint);
  446. afx_msg void OnClose();
  447. afx_msg void OnTimer(UINT_PTR);
  448. afx_msg void OnPluginManager();
  449. afx_msg void OnClipboardManager();
  450. afx_msg LRESULT OnViewMIDIMapping(WPARAM wParam, LPARAM lParam);
  451. afx_msg void OnUpdateTime(CCmdUI *pCmdUI);
  452. afx_msg void OnUpdateUser(CCmdUI *pCmdUI);
  453. afx_msg void OnUpdateInfo(CCmdUI *pCmdUI);
  454. afx_msg void OnUpdateXInfo(CCmdUI *pCmdUI);
  455. afx_msg void OnUpdateMidiRecord(CCmdUI *pCmdUI);
  456. afx_msg void OnPlayerPause();
  457. afx_msg void OnMidiRecord();
  458. afx_msg void OnPrevOctave();
  459. afx_msg void OnNextOctave();
  460. afx_msg void OnPanic();
  461. afx_msg void OnReportBug();
  462. afx_msg BOOL OnInternetLink(UINT nID);
  463. afx_msg LRESULT OnUpdatePosition(WPARAM, LPARAM lParam);
  464. afx_msg LRESULT OnUpdateViews(WPARAM modDoc, LPARAM hint);
  465. afx_msg LRESULT OnSetModified(WPARAM modDoc, LPARAM);
  466. afx_msg void OnOpenTemplateModule(UINT nId);
  467. afx_msg void OnExampleSong(UINT nId);
  468. afx_msg void OnOpenMRUItem(UINT nId);
  469. afx_msg void OnUpdateMRUItem(CCmdUI *cmd);
  470. afx_msg LRESULT OnInvalidatePatterns(WPARAM, LPARAM);
  471. afx_msg LRESULT OnCustomKeyMsg(WPARAM, LPARAM);
  472. afx_msg void OnInternetUpdate();
  473. afx_msg void OnUpdateAvailable();
  474. afx_msg void OnShowSettingsFolder();
  475. #if defined(MPT_ENABLE_UPDATE)
  476. afx_msg LRESULT OnUpdateCheckStart(WPARAM wparam, LPARAM lparam);
  477. afx_msg LRESULT OnUpdateCheckProgress(WPARAM wparam, LPARAM lparam);
  478. afx_msg LRESULT OnUpdateCheckCanceled(WPARAM wparam, LPARAM lparam);
  479. afx_msg LRESULT OnUpdateCheckFailure(WPARAM wparam, LPARAM lparam);
  480. afx_msg LRESULT OnUpdateCheckSuccess(WPARAM wparam, LPARAM lparam);
  481. afx_msg LRESULT OnToolbarUpdateIndicatorClick(WPARAM wparam, LPARAM lparam);
  482. #endif // MPT_ENABLE_UPDATE
  483. afx_msg void OnHelp();
  484. afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData);
  485. afx_msg void OnDropFiles(HDROP hDropInfo);
  486. afx_msg BOOL OnQueryEndSession();
  487. afx_msg void OnActivateApp(BOOL active, DWORD threadID);
  488. //}}AFX_MSG
  489. DECLARE_MESSAGE_MAP()
  490. public:
  491. afx_msg void OnInitMenu(CMenu *pMenu);
  492. bool UpdateEffectKeys(const CModDoc *modDoc);
  493. afx_msg void OnKillFocus(CWnd* pNewWnd);
  494. afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
  495. // Defines maximum number of items in example modules menu.
  496. static constexpr size_t nMaxItemsInExampleModulesMenu = 50;
  497. static constexpr size_t nMaxItemsInTemplateModulesMenu = 50;
  498. private:
  499. /// Array of paths of example modules that are available from help menu.
  500. std::vector<mpt::PathString> m_ExampleModulePaths;
  501. /// Array of paths of template modules that are available from file menu.
  502. std::vector<mpt::PathString> m_TemplateModulePaths;
  503. };
  504. /////////////////////////////////////////////////////////////////////////////
  505. //{{AFX_INSERT_LOCATION}}
  506. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  507. OPENMPT_NAMESPACE_END