From: <sag...@us...> - 2010-02-22 20:53:16
|
Revision: 508 http://modplug.svn.sourceforge.net/modplug/?rev=508&view=rev Author: saga-games Date: 2010-02-22 20:53:09 +0000 (Mon, 22 Feb 2010) Log Message: ----------- [Fix] Pattern Editor: Now, plugin slot 100 can also be automated using PC Notes. [Fix] Instrument Editor: It was impossible to assign plugin slot 100 to an instrument. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/View_pat.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2010-02-22 00:21:17 UTC (rev 507) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2010-02-22 20:53:09 UTC (rev 508) @@ -1174,7 +1174,7 @@ } else { m_CbnMidiCh.SetCurSel(0); } - if (pIns->nMixPlug < MAX_MIXPLUGINS) { + if (pIns->nMixPlug <= MAX_MIXPLUGINS) { m_CbnMixPlug.SetCurSel(pIns->nMixPlug); } else { m_CbnMixPlug.SetCurSel(0); @@ -2027,7 +2027,7 @@ //--------------------------------------- { MODINSTRUMENT *pIns = m_pSndFile->Instruments[m_nInstrument]; - BYTE nPlug = static_cast<BYTE>(m_CbnMixPlug.GetItemData(m_CbnMixPlug.GetCurSel()) & 0xff); + PLUGINDEX nPlug = static_cast<PLUGINDEX>(m_CbnMixPlug.GetItemData(m_CbnMixPlug.GetCurSel()) & 0xff); // TODO is the 0xFF necessary? if (pIns) { @@ -2042,7 +2042,7 @@ m_CbnPluginVolumeHandling.EnableWindow(); } - if (nPlug>=0 && nPlug<MAX_MIXPLUGINS+1) + if (nPlug>=0 && nPlug <= MAX_MIXPLUGINS) { if ((!IsLocked()) && pIns->nMixPlug != nPlug) { m_pModDoc->SetModified(); @@ -2852,5 +2852,5 @@ m_CbnMixPlug.SetItemData(m_CbnMixPlug.AddString(s), nPlug); } MODINSTRUMENT *pIns = m_pSndFile->Instruments[m_nInstrument]; - if ((pIns) && (pIns->nMixPlug < MAX_MIXPLUGINS)) m_CbnMixPlug.SetCurSel(pIns->nMixPlug); + if ((pIns) && (pIns->nMixPlug <= MAX_MIXPLUGINS)) m_CbnMixPlug.SetCurSel(pIns->nMixPlug); } Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-02-22 00:21:17 UTC (rev 507) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-02-22 20:53:09 UTC (rev 508) @@ -4078,13 +4078,26 @@ MODCOMMAND *p = pSndFile->Patterns[m_nPattern].GetpModCommand(m_nRow, nChn); MODCOMMAND oldcmd = *p; // This is the command we are about to overwrite - UINT instr = p->instr; + UINT instr = p->instr, nTotalMax, nTempMax; + if(p->IsPcNote()) // this is a plugin index + { + nTotalMax = MAX_MIXPLUGINS + 1; + nTempMax = MAX_MIXPLUGINS + 1; + } else if(pSndFile->GetNumInstruments() > 0) // this is an instrument index + { + nTotalMax = MAX_INSTRUMENTS; + nTempMax = pSndFile->GetNumInstruments(); + } else + { + nTotalMax = MAX_SAMPLES; + nTempMax = pSndFile->GetNumSamples(); + } + instr = ((instr * 10) + val) % 1000; - if (instr >= MAX_INSTRUMENTS) instr = instr % 100; - if ( ((pSndFile->m_nInstruments==0) && (pSndFile->m_nSamples<100)) || // if we're using samples & have less than 100 samples - (pSndFile->m_nInstruments < 100)) { // or if we're using instruments and have less than 100 instruments - instr = instr % 100; // --> ensure the entered instrument value is less than 100. - } + if (instr >= nTotalMax) instr = instr % 100; + if (nTempMax < 100) // if we're using samples & have less than 100 samples + instr = instr % 100; // or if we're using instruments and have less than 100 instruments + // --> ensure the entered instrument value is less than 100. p->instr = instr; if (IsEditingEnabled_bmsg()) @@ -4973,7 +4986,7 @@ //Add options to remove instrument from selection. AppendMenu(instrumentChangeMenu, MF_SEPARATOR, 0, 0); AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT, "Remove instrument"); - AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT+GetCurrentInstrument(), "Set to current instrument"); + AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT + GetCurrentInstrument(), "Set to current instrument"); } return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |