From: <sag...@us...> - 2011-10-03 19:20:35
|
Revision: 1079 http://modplug.svn.sourceforge.net/modplug/?rev=1079&view=rev Author: saga-games Date: 2011-10-03 19:20:29 +0000 (Mon, 03 Oct 2011) Log Message: ----------- [Imp] General Tab: Like the plugin preset box, the plugin parameter selection box is now only populated when needed. [Imp] General Tab: Plugin parameter indexes aren't ORed with 0x80 anymore (why was this done in the first place?) Modified Paths: -------------- trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/View_gen.h trunk/OpenMPT/mptrack/resource.h Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2011-10-03 16:52:48 UTC (rev 1078) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2011-10-03 19:20:29 UTC (rev 1079) @@ -13,9 +13,7 @@ #include "SelectPluginDialog.h" #include "../common/StringFixer.h" -#define ID_FXCOMMANDS_BASE 41000 - IMPLEMENT_SERIAL(CViewGlobals, CFormView, 0) BEGIN_MESSAGE_MAP(CViewGlobals, CFormView) @@ -79,7 +77,10 @@ ON_CBN_SELCHANGE(IDC_COMBO3, OnFx3Changed) ON_CBN_SELCHANGE(IDC_COMBO4, OnFx4Changed) ON_CBN_SELCHANGE(IDC_COMBO5, OnPluginChanged) + ON_CBN_SELCHANGE(IDC_COMBO6, OnParamChanged) + ON_CBN_SETFOCUS(IDC_COMBO6, OnFillParamCombo) + ON_CBN_SELCHANGE(IDC_COMBO7, OnOutputRoutingChanged) // -> CODE#0002 @@ -441,7 +442,9 @@ // -> CODE#0028 // -> DESC="effect plugin mixing mode combo" - if(pVstPlugin && pVstPlugin->isInstrument()){ // ericus 18/02/2005 : disable mix mode for VSTi + if(pVstPlugin && pVstPlugin->isInstrument()) + { + // ericus 18/02/2005 : disable mix mode for VSTi ::EnableWindow(::GetDlgItem(m_hWnd, IDC_COMBO9), FALSE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_CHECK12), FALSE); } @@ -462,28 +465,26 @@ if (pVstPlugin) { -// -> CODE#0002 -// -> DESC="VST plugins presets" - CHAR sname[64]; -// -! NEW_FEATURE#0002 UINT nParams = pVstPlugin->GetNumParameters(); m_CbnParam.SetRedraw(FALSE); m_CbnParam.ResetContent(); - UINT i = 0; - for (i=0; i<nParams; i++) + if (m_nCurrentParam >= nParams) m_nCurrentParam = 0; + + if(nParams) { - pVstPlugin->GetParamName(i, sname, sizeof(sname)); - wsprintf(s, "%02X: %s", i|0x80, sname); - m_CbnParam.SetItemData(m_CbnParam.AddString(s), i); + char sname[64]; + pVstPlugin->GetParamName(m_nCurrentParam, sname, sizeof(sname)); + wsprintf(s, "%02X: %s", m_nCurrentParam, sname); + m_CbnParam.SetItemData(m_CbnParam.AddString(s), m_nCurrentParam); } - m_CbnParam.SetRedraw(TRUE); - if (m_nCurrentParam >= nParams) m_nCurrentParam = 0; - m_CbnParam.SetCurSel(m_nCurrentParam); + + m_CbnParam.SetCurSel(0); + m_CbnParam.SetRedraw(TRUE); OnParamChanged(); + + // Input / Output type pVstPlugin->GetPluginType(s); -// -> CODE#0002 -// -> DESC="VST plugins presets" // For now, only display the "current" preset. // This prevents the program from hanging when switching between plugin slots or // switching to the general tab and the first plugin in the list has a lot of presets. @@ -500,15 +501,13 @@ m_sbDryRatio.EnableWindow(TRUE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT14), TRUE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_BUTTON3), TRUE); -// -! NEW_FEATURE#0002 } else { s[0] = 0; if (m_CbnParam.GetCount() > 0) m_CbnParam.ResetContent(); m_nCurrentParam = 0; -// -> CODE#0002 -// -> DESC="VST plugins presets" + CHAR s2[16]; m_CbnPreset.SetRedraw(FALSE); m_CbnPreset.ResetContent(); @@ -521,7 +520,6 @@ m_sbDryRatio.EnableWindow(FALSE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT14), FALSE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_BUTTON3), FALSE); -// -! NEW_FEATURE#0002 } SetDlgItemText(IDC_TEXT6, s); int outputsel = 0; @@ -955,7 +953,7 @@ void CViewGlobals::OnParamChanged() //--------------------------------- { - int cursel = m_CbnParam.GetCurSel(); + int cursel = m_CbnParam.GetItemData(m_CbnParam.GetCurSel()); CModDoc *pModDoc = GetDocument(); CHAR s[256]; PSNDMIXPLUGIN pPlugin; @@ -964,11 +962,11 @@ if ((m_nCurrentPlugin >= MAX_MIXPLUGINS) || (!pModDoc)) return; pSndFile = pModDoc->GetSoundFile(); pPlugin = &pSndFile->m_MixPlugins[m_nCurrentPlugin]; - if (pPlugin->pMixPlugin) + if (pPlugin->pMixPlugin && cursel != CB_ERR) { CVstPlugin *pVstPlugin = (CVstPlugin *)pPlugin->pMixPlugin; - UINT nParams = pVstPlugin->GetNumParameters(); - if ((cursel >= 0) && (cursel < (int)nParams)) m_nCurrentParam = cursel; + const PlugParamIndex nParams = pVstPlugin->GetNumParameters(); + if ((cursel >= 0) && (cursel < nParams)) m_nCurrentParam = cursel; if (m_nCurrentParam < nParams) { CHAR sunits[64], sdisplay[64]; @@ -1509,6 +1507,41 @@ } +// The plugin param box is only filled when it gets the focus (done here). +void CViewGlobals::OnFillParamCombo() +//----------------------------------- +{ + // no need to fill it again. + if(m_CbnParam.GetCount() > 1) + return; + + if(GetDocument() == nullptr) return; + CSoundFile *pSndFile = GetDocument()->GetSoundFile(); + if(pSndFile == nullptr) return; + if (m_nCurrentPlugin >= MAX_MIXPLUGINS) m_nCurrentPlugin = 0; + PSNDMIXPLUGIN pPlugin = &(pSndFile->m_MixPlugins[m_nCurrentPlugin]); + CVstPlugin *pVstPlugin = (pPlugin->pMixPlugin) ? (CVstPlugin *)pPlugin->pMixPlugin : nullptr; + if(pVstPlugin == nullptr) return; + + CHAR s[128]; + CHAR sname[64]; + const PlugParamIndex nParams = pVstPlugin->GetNumParameters(); + m_CbnParam.SetRedraw(FALSE); + m_CbnParam.ResetContent(); + + for(PlugParamIndex i = 0; i < nParams; i++) + { + pVstPlugin->GetParamName(i, sname, sizeof(sname)); + wsprintf(s, "%02X: %s", i, sname); + m_CbnParam.SetItemData(m_CbnParam.AddString(s), i); + } + + if (m_nCurrentParam >= nParams) m_nCurrentParam = 0; + m_CbnParam.SetCurSel(m_nCurrentParam); + m_CbnParam.SetRedraw(TRUE); +} + + // The preset box is only filled when it gets the focus (done here). void CViewGlobals::OnFillProgramCombo() //------------------------------------- Modified: trunk/OpenMPT/mptrack/View_gen.h =================================================================== --- trunk/OpenMPT/mptrack/View_gen.h 2011-10-03 16:52:48 UTC (rev 1078) +++ trunk/OpenMPT/mptrack/View_gen.h 2011-10-03 19:20:29 UTC (rev 1079) @@ -112,6 +112,7 @@ afx_msg void OnFx4Changed(); afx_msg void OnPluginChanged(); afx_msg void OnPluginNameChanged(); + afx_msg void OnFillParamCombo(); afx_msg void OnParamChanged(); // -> CODE#0002 // -> DESC="VST plugins presets" Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2011-10-03 16:52:48 UTC (rev 1078) +++ trunk/OpenMPT/mptrack/resource.h 2011-10-03 19:20:29 UTC (rev 1079) @@ -1207,6 +1207,8 @@ #define ID_HELP_EXAMPLEMODULES 44459 #define ID_FILE_SAVEASTEMPLATE 44460 #define ID_ORDERLIST_INSERT_SEPARATOR 44461 +#define ID_FXCOMMANDS_BASE 44462 +// From here: Command range [ID_FXCOMMANDS_BASE, ID_FXCOMMANDS_BASE + 10] // Next default values for new objects // @@ -1214,7 +1216,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 531 -#define _APS_NEXT_COMMAND_VALUE 44462 +#define _APS_NEXT_COMMAND_VALUE 44474 #define _APS_NEXT_CONTROL_VALUE 2438 #define _APS_NEXT_SYMED_VALUE 901 #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |