From: <sag...@us...> - 2009-07-19 21:41:15
|
Revision: 297 http://modplug.svn.sourceforge.net/modplug/?rev=297&view=rev Author: saga-games Date: 2009-07-19 21:41:08 +0000 (Sun, 19 Jul 2009) Log Message: ----------- [Fix] VST: Default dirs for VST presets were not working properly [Fix] Pattern editor: Echo paste did not work properly if edit order was different from playback order [Fix] Pattern editor: Keyboard split note was off by one [Fix] Instrument editor: No relative values are shown for envelopes with no release node (status bar) [Fix] Find/Replace: (Hopefully) temporary fix for instrument sorting [Fix] Compatibility: Pattern loops are now handeled correctly in XM (using compatibility switch) and MOD files [Ref] Some small code changes (Usage of types PATTERNINDEX, ORDERINDEX, ROWINDEX) Modified Paths: -------------- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/dlg_misc.h trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2009-07-16 16:08:49 UTC (rev 296) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2009-07-19 21:41:08 UTC (rev 297) @@ -115,8 +115,11 @@ CFileDialog dlg(TRUE, "fxp", NULL, OFN_HIDEREADONLY| OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_ENABLESIZING | OFN_NOREADONLYRETURN, "VST Program (*.fxp)|*.fxp||", theApp.m_pMainWnd); - dlg.m_ofn.lpstrInitialDir = CMainFrame::GetWorkingDirectory(DIR_PLUGINPRESETS); + const LPCTSTR pszWdir = CMainFrame::GetWorkingDirectory(DIR_PLUGINPRESETS); + if(pszWdir[0]) + dlg.m_ofn.lpstrInitialDir = pszWdir; + if (!(dlg.DoModal() == IDOK)) return; CMainFrame::SetWorkingDirectory(dlg.GetFileName(), DIR_PLUGINPRESETS, true); @@ -135,8 +138,13 @@ CFileDialog dlg(FALSE, "fxp", NULL, OFN_HIDEREADONLY| OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_ENABLESIZING | OFN_NOREADONLYRETURN, "VST Program (*.fxp)|*.fxp||", theApp.m_pMainWnd); + const LPCTSTR pszWdir = CMainFrame::GetWorkingDirectory(DIR_PLUGINPRESETS); + if(pszWdir[0]) + dlg.m_ofn.lpstrInitialDir = pszWdir; if (!(dlg.DoModal() == IDOK)) return; + CMainFrame::SetWorkingDirectory(dlg.GetFileName(), DIR_PLUGINPRESETS, true); + //TODO: exception handling if (!(m_pVstPlugin->SaveProgram(dlg.GetFileName()))) ::AfxMessageBox("Error saving preset."); Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2009-07-16 16:08:49 UTC (rev 296) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2009-07-19 21:41:08 UTC (rev 297) @@ -2877,7 +2877,7 @@ return NULL; } -HWND CModDoc::GetEditPosition(UINT &row, UINT &pat, UINT &ord) +HWND CModDoc::GetEditPosition(ROWINDEX &row, PATTERNINDEX &pat, ORDERINDEX &ord) //------------------------------------------------------------ { HWND followSonghWnd; @@ -3004,7 +3004,11 @@ } CSoundFile *pSndFile = GetSoundFile(); - UINT nPat,nOrd,nRow; + + ROWINDEX nRow; + PATTERNINDEX nPat; + ORDERINDEX nOrd; + HWND followSonghWnd; followSonghWnd = GetEditPosition(nRow, nPat, nOrd); @@ -3060,7 +3064,11 @@ } CSoundFile *pSndFile = GetSoundFile(); - UINT nRow,nPat,nOrd; + + ROWINDEX nRow; + PATTERNINDEX nPat; + ORDERINDEX nOrd; + HWND followSonghWnd; followSonghWnd = GetEditPosition(nRow,nPat,nOrd); @@ -3111,7 +3119,11 @@ } CSoundFile *pSndFile = GetSoundFile(); - UINT nPat,nOrd,nRow; + + ROWINDEX nRow; + PATTERNINDEX nPat; + ORDERINDEX nOrd; + HWND followSonghWnd; followSonghWnd = GetEditPosition(nRow,nPat,nOrd); Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2009-07-16 16:08:49 UTC (rev 296) +++ trunk/OpenMPT/mptrack/Moddoc.h 2009-07-19 21:41:08 UTC (rev 297) @@ -240,10 +240,10 @@ UINT FindSampleParent(UINT nSmp) const; UINT FindInstrumentChild(UINT nIns) const; BOOL MoveOrder(UINT nSourceNdx, UINT nDestNdx, BOOL bUpdate=TRUE, BOOL bCopy=FALSE); - BOOL ExpandPattern(UINT nPattern); - BOOL ShrinkPattern(UINT nPattern); - BOOL CopyPattern(UINT nPattern, DWORD dwBeginSel, DWORD dwEndSel); - BOOL PastePattern(UINT nPattern, DWORD dwBeginSel, BOOL mix, BOOL ITStyleMix=FALSE); //rewbs.mixpaste + BOOL ExpandPattern(PATTERNINDEX nPattern); + BOOL ShrinkPattern(PATTERNINDEX nPattern); + BOOL CopyPattern(PATTERNINDEX nPattern, DWORD dwBeginSel, DWORD dwEndSel); + BOOL PastePattern(PATTERNINDEX nPattern, DWORD dwBeginSel, BOOL mix, BOOL ITStyleMix=FALSE); //rewbs.mixpaste BOOL CopyEnvelope(UINT nIns, UINT nEnv); BOOL PasteEnvelope(UINT nIns, UINT nEnv); @@ -253,7 +253,7 @@ BOOL CanUndo(); LRESULT ActivateView(UINT nIdView, DWORD dwParam); void UpdateAllViews(CView *pSender, LPARAM lHint=0L, CObject *pHint=NULL); - HWND GetEditPosition(UINT &row, UINT &pat, UINT &ord); //rewbs.customKeys + HWND GetEditPosition(ROWINDEX &row, PATTERNINDEX &pat, ORDERINDEX &ord); //rewbs.customKeys LRESULT OnCustomKeyMsg(WPARAM, LPARAM); //rewbs.customKeys void TogglePluginEditor(UINT m_nCurrentPlugin); //rewbs.patPlugNames void RecordParamChange(int slot, long param); Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2009-07-16 16:08:49 UTC (rev 296) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-07-19 21:41:08 UTC (rev 297) @@ -1564,7 +1564,7 @@ } -BOOL CModDoc::ExpandPattern(UINT nPattern) +BOOL CModDoc::ExpandPattern(PATTERNINDEX nPattern) //---------------------------------------- { // -> CODE#0008 @@ -1578,7 +1578,7 @@ } -BOOL CModDoc::ShrinkPattern(UINT nPattern) +BOOL CModDoc::ShrinkPattern(PATTERNINDEX nPattern) //---------------------------------------- { if ((nPattern >= m_SndFile.Patterns.Size()) || (!m_SndFile.Patterns[nPattern])) return FALSE; @@ -1598,7 +1598,7 @@ static LPCSTR lpszClipboardPatternHdr = "ModPlug Tracker %3s\x0D\x0A"; -BOOL CModDoc::CopyPattern(UINT nPattern, DWORD dwBeginSel, DWORD dwEndSel) +BOOL CModDoc::CopyPattern(PATTERNINDEX nPattern, DWORD dwBeginSel, DWORD dwEndSel) //------------------------------------------------------------------------ { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); @@ -1748,7 +1748,7 @@ // -> CODE#0014 // -> DESC="vst wet/dry slider" //BOOL CModDoc::PastePattern(UINT nPattern, DWORD dwBeginSel) -BOOL CModDoc::PastePattern(UINT nPattern, DWORD dwBeginSel, BOOL mix, BOOL ITStyleMix) +BOOL CModDoc::PastePattern(PATTERNINDEX nPattern, DWORD dwBeginSel, BOOL mix, BOOL ITStyleMix) // -! NEW_FEATURE#0014 //--------------------------------------------------------- { @@ -1762,18 +1762,22 @@ if ((hCpy) && ((p = (LPSTR)GlobalLock(hCpy)) != NULL)) { - PrepareUndo(nPattern, 0,0, m_SndFile.m_nChannels, m_SndFile.PatternSize[nPattern]); + PrepareUndo(nPattern, 0, 0, m_SndFile.m_nChannels, m_SndFile.PatternSize[nPattern]); BYTE spdmax = (m_SndFile.m_nType & MOD_TYPE_MOD) ? 0x20 : 0x1F; DWORD dwMemSize = GlobalSize(hCpy); MODCOMMAND *m = m_SndFile.Patterns[nPattern]; UINT nrow = dwBeginSel >> 16; UINT ncol = (dwBeginSel & 0xFFFF) >> 3; - ORDERINDEX oCurrentOrder = m_SndFile.GetCurrentOrder(); //jojo.echopaste UINT col; BOOL bS3M = FALSE, bOk = FALSE; UINT len = 0; MODCOMMAND origModCmd; + ORDERINDEX oCurrentOrder; //jojo.echopaste + ROWINDEX rTemp; + PATTERNINDEX pTemp; + GetEditPosition(rTemp, pTemp, oCurrentOrder); + if ((nrow >= m_SndFile.PatternSize[nPattern]) || (ncol >= m_SndFile.m_nChannels)) goto PasteDone; m += nrow * m_SndFile.m_nChannels; // Search for signature Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2009-07-16 16:08:49 UTC (rev 296) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2009-07-19 21:41:08 UTC (rev 297) @@ -1739,13 +1739,13 @@ if (nVal < 0) nVal = 0; if (nVal > 64) nVal = 64; if (nTick < 0) nTick = 0; - if (nTick<=EnvGetReleaseNodeTick()+1) { + if (nTick <= EnvGetReleaseNodeTick() + 1 || EnvGetReleaseNode() == ENV_RELEASE_NODE_UNSET) { int displayVal = (m_nEnv != ENV_VOLUME) ? nVal-32 : nVal; wsprintf(s, "Tick %d, [%d]", nTick, displayVal); } else { - int displayVal = (nVal-EnvGetReleaseNodeValue())*2; - displayVal = (m_nEnv != ENV_VOLUME) ? displayVal-32 : displayVal; - wsprintf(s, "Tick %d, [Rel%c%d]", nTick, displayVal>0?'+':'-', abs(displayVal)); + int displayVal = (nVal - EnvGetReleaseNodeValue()) * 2; + displayVal = (m_nEnv != ENV_VOLUME) ? displayVal - 32 : displayVal; + wsprintf(s, "Tick %d, [Rel%c%d]", nTick, displayVal > 0 ? '+' : '-', abs(displayVal)); } UpdateIndicator(s); if ((m_dwStatus & INSSTATUS_DRAGGING) && (m_nDragItem)) Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2009-07-16 16:08:49 UTC (rev 296) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-07-19 21:41:08 UTC (rev 297) @@ -3870,10 +3870,10 @@ const UINT nTick = pSndFile->m_nTickCount; const PATTERNINDEX nPatPlayback = pSndFile->m_nPattern; - const bool isSplit = (note < m_nSplitNote); + const bool isSplit = (note <= m_nSplitNote); + UINT ins = 0; if (pModDoc) { - UINT ins = 0; if (isSplit) { ins = m_nSplitInstrument; @@ -3959,7 +3959,7 @@ //Enter note off p->note = NOTE_KEYOFF; - p->instr = (bChordMode) ? 0 : GetCurrentInstrument(); //p->instr = 0; + p->instr = (bChordMode) ? 0 : ins; //p->instr = 0; //Writing the instrument as well - probably someone finds this annoying :) p->volcmd = 0; p->vol = 0; @@ -4520,7 +4520,7 @@ bool CViewPattern::HandleSplit(MODCOMMAND* p, int note) //----------------------------------------------------- { - if (note>=m_nSplitNote) + if (note>m_nSplitNote) { p->note = note; UINT nins = GetCurrentInstrument(); Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2009-07-16 16:08:49 UTC (rev 296) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2009-07-19 21:41:08 UTC (rev 297) @@ -656,10 +656,10 @@ { if (pSndFile->m_nInstruments) { - wsprintf(s, "%02d:%s", n, (pSndFile->Headers[n]) ? pSndFile->Headers[n]->name : ""); + wsprintf(s, "%03d:%s", n, (pSndFile->Headers[n]) ? pSndFile->Headers[n]->name : ""); } else { - wsprintf(s, "%02d:%s", n, pSndFile->m_szNames[n]); + wsprintf(s, "%03d:%s", n, pSndFile->m_szNames[n]); } combo->SetItemData(combo->AddString(s), n); } Modified: trunk/OpenMPT/mptrack/dlg_misc.h =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.h 2009-07-16 16:08:49 UTC (rev 296) +++ trunk/OpenMPT/mptrack/dlg_misc.h 2009-07-19 21:41:08 UTC (rev 297) @@ -534,7 +534,7 @@ ModCompatibilityExportTip = 0, ItCompatibilityExportTip = 1, ConfirmSignUnsignWhenPlaying = 2, - enMsgBoxHidableMessage_count = 3 + enMsgBoxHidableMessage_count }; void MsgBoxHidable(enMsgBoxHidableMessage enMsg); Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-07-16 16:08:49 UTC (rev 296) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-07-19 21:41:08 UTC (rev 297) @@ -3262,7 +3262,8 @@ pChn->nPatternLoopCount--; if(!pChn->nPatternLoopCount) { - if(GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT) && GetModFlag(MSF_COMPATIBLE_PLAY)) + //IT compatibility 10. Pattern loops (+ same fix for XM and MOD files) + if((GetType() & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT) && GetModFlag(MSF_COMPATIBLE_PLAY)) || (GetType() & (MOD_TYPE_MOD))) pChn->nPatternLoop = m_nRow+1; return -1; @@ -3270,8 +3271,9 @@ } else { MODCHANNEL *p = Chn; - - if(!(GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT) && GetModFlag(MSF_COMPATIBLE_PLAY))) + + //IT compatibility 10. Pattern loops (+ same fix for XM and MOD files) + if(!((GetType() & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT) && GetModFlag(MSF_COMPATIBLE_PLAY)) || (GetType() & (MOD_TYPE_MOD)))) { for (UINT i=0; i<m_nChannels; i++, p++) if (p != pChn) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |