From: <rel...@us...> - 2009-01-10 11:10:56
|
Revision: 244 http://modplug.svn.sourceforge.net/modplug/?rev=244&view=rev Author: relabsoluness Date: 2009-01-10 11:10:49 +0000 (Sat, 10 Jan 2009) Log Message: ----------- / Pattern: The keyboard split 'feature' when entering chords is removed (bug 2790). . Pattern: Undo should now work with chords. Modified Paths: -------------- trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/pattern.h Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2009-01-10 07:52:25 UTC (rev 243) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-01-10 11:10:49 UTC (rev 244) @@ -4096,20 +4096,19 @@ if ((pModDoc) && (pMainFrm)) { CSoundFile *pSndFile = pModDoc->GetSoundFile(); - MODCOMMAND *p = pSndFile->Patterns[m_nPattern], *prowbase; - MODCOMMAND oldcmd; // This is the command we are about to overwrite - UINT nChn = (m_dwCursor & 0xFFFF) >> 3; + const CHANNELINDEX nChn = GetChanFromCursor(m_dwCursor); UINT nPlayIns = 0; - PrepareUndo(m_dwBeginSel, m_dwEndSel); - bool isSplit; + // Simply backup the whole row. + pModDoc->PrepareUndo(m_nPattern, nChn, m_nRow, pSndFile->GetNumChannels(), 1); - // -- Work out where to put the new note - prowbase = p + m_nRow * pSndFile->m_nChannels; - p = prowbase + nChn; - oldcmd = *p; + PatternRow prowbase = pSndFile->Patterns[m_nPattern].GetRow(m_nRow); + MODCOMMAND* p = &prowbase[nChn]; + const MODCOMMAND oldcmd = *p; // This is the command we are about to overwrite + // -- establish note data - isSplit = HandleSplit(p, note); + //const bool isSplit = HandleSplit(p, note); + HandleSplit(p, note); PMPTCHORD pChords = pMainFrm->GetChords(); UINT baseoctave = pMainFrm->GetBaseOctave(); @@ -4117,11 +4116,12 @@ UINT nNote; if (nchord < 3*12) { - UINT nchordnote; - if (isSplit) - nchordnote = pChords[nchord].key + baseoctave*(p->note%12) + 1; - else - nchordnote = pChords[nchord].key + baseoctave*12 + 1; + UINT nchordnote = pChords[nchord].key + baseoctave*12 + 1; + // Rev. 244, commented the isSplit conditions below, can't see the point in it. + //if (isSplit) + // nchordnote = pChords[nchord].key + baseoctave*(p->note%12) + 1; + //else + // nchordnote = pChords[nchord].key + baseoctave*12 + 1; if (nchordnote <= NOTE_MAX) { UINT nchordch = nChn, nchno = 0; @@ -4174,8 +4174,7 @@ InvalidateRow(); UpdateIndicator(); } - if (((pMainFrm->GetFollowSong(pModDoc) != m_hWnd) || (pSndFile->IsPaused()) - || (!(m_dwStatus & PATSTATUS_FOLLOWSONG)))) + if ( IsLiveRecord(*pMainFrm, *pModDoc, *pSndFile) == false ) { if ((m_nSpacing > 0) && (m_nSpacing <= MAX_SPACING)) SetCurrentRow(m_nRow+m_nSpacing); Modified: trunk/OpenMPT/mptrack/pattern.h =================================================================== --- trunk/OpenMPT/mptrack/pattern.h 2009-01-10 07:52:25 UTC (rev 243) +++ trunk/OpenMPT/mptrack/pattern.h 2009-01-10 11:10:49 UTC (rev 244) @@ -8,7 +8,9 @@ class CPatternContainer; +typedef MODCOMMAND* PatternRow; + //============ class CPattern //============ @@ -39,6 +41,10 @@ // Return true if modcommand can be accessed from given row, false otherwise. bool IsValidRow(const ROWINDEX iRow) const {return (iRow < GetNumRows());} + // Return PatternRow object which has operator[] defined so that MODCOMMAND + // at (iRow, iChn) can be accessed with GetRow(iRow)[iChn]. + PatternRow GetRow(const ROWINDEX iRow) {return GetpModCommand(iRow, 0);} + CHANNELINDEX GetNumChannels() const; bool Resize(const ROWINDEX newRowCount, const bool showDataLossWarning = true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |