From: <sag...@us...> - 2015-06-27 14:14:17
|
Revision: 5368 http://sourceforge.net/p/modplug/code/5368 Author: saga-games Date: 2015-06-27 14:14:12 +0000 (Sat, 27 Jun 2015) Log Message: ----------- [Mod] Use custom window message to send automation messages from plugin to OpenMPT GUI (less unnecessary view updates, and in case of bridged plugins the GUI updates now happen in the correct thread) Modified Paths: -------------- trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/View_gen.h trunk/OpenMPT/mptrack/Vstplug.cpp Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2015-06-27 13:54:03 UTC (rev 5367) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2015-06-27 14:14:12 UTC (rev 5368) @@ -50,6 +50,7 @@ WM_MOD_INSTRSELECTED, WM_MOD_KEYCOMMAND, WM_MOD_RECORDPARAM, + WM_MOD_PLUGPARAMAUTOMATE, }; enum Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2015-06-27 13:54:03 UTC (rev 5367) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2015-06-27 14:14:12 UTC (rev 5368) @@ -109,6 +109,7 @@ ON_MESSAGE(WM_MOD_UNLOCKCONTROLS, OnUnlockControls) ON_MESSAGE(WM_MOD_VIEWMSG, OnModViewMsg) ON_MESSAGE(WM_MOD_MIDIMSG, OnMidiMsg) + ON_MESSAGE(WM_MOD_PLUGPARAMAUTOMATE, OnParamAutomated) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -769,12 +770,9 @@ const PlugParamIndex nParams = pVstPlugin->GetNumParameters(); if(m_nCurrentParam < nParams) { - float fValue = 0.01f * n; - wsprintf(s, "%d.%02d", n/100, n%100); - SetDlgItemText(IDC_EDIT14, s); if (nSBCode == SB_THUMBPOSITION || nSBCode == SB_THUMBTRACK || nSBCode == SB_ENDSCROLL) { - pVstPlugin->SetParameter(m_nCurrentParam, fValue); + pVstPlugin->SetParameter(m_nCurrentParam, 0.01f * n); OnParamChanged(); SetPluginModified(); } @@ -962,6 +960,17 @@ } +LRESULT CViewGlobals::OnParamAutomated(WPARAM plugin, LPARAM param) +//----------------------------------------------------------------- +{ + if(plugin == m_nCurrentPlugin && param == m_nCurrentParam) + { + OnParamChanged(); + } + return 0; +} + + void CViewGlobals::OnParamChanged() //--------------------------------- { Modified: trunk/OpenMPT/mptrack/View_gen.h =================================================================== --- trunk/OpenMPT/mptrack/View_gen.h 2015-06-27 13:54:03 UTC (rev 5367) +++ trunk/OpenMPT/mptrack/View_gen.h 2015-06-27 14:14:12 UTC (rev 5368) @@ -135,6 +135,7 @@ afx_msg void OnMovePlugToSlot(); afx_msg void OnInsertSlot(); afx_msg void OnClonePlug(); + LRESULT OnParamAutomated(WPARAM plugin, LPARAM param); afx_msg void OnWetDryExpandChanged(); afx_msg void OnSpecialMixProcessingChanged(); Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2015-06-27 13:54:03 UTC (rev 5367) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2015-06-27 14:14:12 UTC (rev 5368) @@ -566,8 +566,9 @@ fileSel->returnMultiplePaths = new (std::nothrow) char *[fileSel->nbReturnPath]; for(size_t i = 0; i < files.size(); i++) { - char *fname = new (std::nothrow) char[files[i].ToLocale().length() + 1]; - strcpy(fname, files[i].ToLocale().c_str()); + const std::string fname_ = files[i].ToLocale(); + char *fname = new (std::nothrow) char[fname_.length() + 1]; + strcpy(fname, fname_.c_str()); fileSel->returnMultiplePaths[i] = fname; } return 1; @@ -2044,8 +2045,7 @@ CMainFrame::GetMainFrame()->ThreadSafeSetModified(pModDoc); } - // Better idea: add an update hint just for plugin params? - pModDoc->UpdateAllViews(nullptr, PluginHint(m_nSlot + 1).Parameter(), nullptr); + pModDoc->PostMessageToAllViews(WM_MOD_PLUGPARAMAUTOMATE, m_nSlot, param); if (CMainFrame::GetInputHandler()->ShiftPressed()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |