From: <sag...@us...> - 2012-12-15 15:45:37
|
Revision: 1462 http://sourceforge.net/p/modplug/code/1462 Author: saga-games Date: 2012-12-15 15:45:30 +0000 (Sat, 15 Dec 2012) Log Message: ----------- [Mod] Added coarse Data Entry shortcuts (+12/+10/+16 depending on column) Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2012-12-15 15:25:36 UTC (rev 1461) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2012-12-15 15:45:30 UTC (rev 1462) @@ -645,6 +645,8 @@ DefineKeyCommand(kcSampleMonoRight, 1890, _T("Convert to Mono (Right Channel)")); DefineKeyCommand(kcSampleMonoSplit, 1891, _T("Convert to Mono (Split Sample)")); DefineKeyCommand(kcQuantizeSettings, 1892, _T("Quantize Settings")); + DefineKeyCommand(kcDataEntryUpCoarse, 1893, _T("Data Entry Up (Coarse)")); + DefineKeyCommand(kcDataEntryDownCoarse, 1894, _T("Data Entry Down (Coarse)")); // Add new key commands here. Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2012-12-15 15:25:36 UTC (rev 1461) +++ trunk/OpenMPT/mptrack/CommandSet.h 2012-12-15 15:45:30 UTC (rev 1462) @@ -266,13 +266,17 @@ kcChannelSettings, kcEndChannelKeys = kcChannelSettings, kcCopyAndLoseSelection, - kcTransposeUp, + kcBeginTranspose, + kcTransposeUp = kcBeginTranspose, kcTransposeDown, kcTransposeOctUp, kcTransposeOctDown, kcTransposeCustom, kcDataEntryUp, kcDataEntryDown, + kcDataEntryUpCoarse, + kcDataEntryDownCoarse, + kcEndTranspose = kcDataEntryDownCoarse, kcPatternAmplify, kcPatternInterpolateNote, kcPatternInterpolateVol, Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2012-12-15 15:25:36 UTC (rev 1461) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2012-12-15 15:45:30 UTC (rev 1462) @@ -485,7 +485,7 @@ if(drawDefaultVolume) { // Displaying sample default volume if there is no volume command. - const CSoundFile *pSndFile = GetDocument()->GetSoundFile(); + const CSoundFile *pSndFile = GetSoundFile(); SAMPLEINDEX sample = mc.instr; if(pSndFile->GetNumInstruments()) { @@ -531,8 +531,8 @@ CHAR s[256]; HGDIOBJ oldpen; CRect rcClient, rect, rc; - CModDoc *pModDoc; - CSoundFile *pSndFile; + const CModDoc *pModDoc; + const CSoundFile *pSndFile; HDC hdc; CHANNELINDEX xofs; ROWINDEX yofs; @@ -779,9 +779,9 @@ } -void CViewPattern::DrawPatternData(HDC hdc, CSoundFile *pSndFile, PATTERNINDEX nPattern, bool selEnable, - bool isPlaying, ROWINDEX startRow, ROWINDEX numRows, CHANNELINDEX startChan, CRect &rcClient, int *pypaint) -//--------------------------------------------------------------------------------------------------------------------------------- +void CViewPattern::DrawPatternData(HDC hdc, const CSoundFile *pSndFile, PATTERNINDEX nPattern, bool selEnable, + bool isPlaying, ROWINDEX startRow, ROWINDEX numRows, CHANNELINDEX startChan, CRect &rcClient, int *pypaint) +//------------------------------------------------------------------------------------------------------------- { uint8 selectedCols[MAX_BASECHANNELS]; // Bit mask of selected channel components static_assert(PatternCursor::lastColumn <= 7, "Columns are used as bitmasks here."); @@ -834,7 +834,7 @@ if (!::RectVisible(hdc, &rect)) { // No speedup for these columns next time - for (UINT iup=startChan; iup<maxcol; iup++) selectedCols[iup] &= ~0x40; + for (CHANNELINDEX iup=startChan; iup<maxcol; iup++) selectedCols[iup] &= ~0x40; goto SkipRow; } rect.right = rect.left + m_szHeader.cx; @@ -1170,14 +1170,12 @@ void CViewPattern::DrawDragSel(HDC hdc) //------------------------------------- { - CModDoc *pModDoc; - CSoundFile *pSndFile; + const CSoundFile *pSndFile = GetSoundFile(); CRect rect; int x1, y1, x2, y2; int nChannels, nRows; - if ((pModDoc = GetDocument()) == nullptr) return; - pSndFile = pModDoc->GetSoundFile(); + if(pSndFile == nullptr) return; // Compute relative movement int dx = (int)m_DragPos.GetChannel() - (int)m_StartSel.GetChannel(); @@ -1296,13 +1294,12 @@ void CViewPattern::UpdateScrollSize() //----------------------------------- { - CModDoc *pModDoc = GetDocument(); - if (pModDoc) + const CSoundFile *pSndFile = GetSoundFile(); + if(pSndFile) { CRect rect; - CSoundFile *pSndFile = pModDoc->GetSoundFile(); SIZE sizeTotal, sizePage, sizeLine; - sizeTotal.cx = m_szHeader.cx + pSndFile->m_nChannels * m_szCell.cx; + sizeTotal.cx = m_szHeader.cx + pSndFile->GetNumChannels() * m_szCell.cx; sizeTotal.cy = m_szHeader.cy + pSndFile->Patterns[m_nPattern].GetNumRows() * m_szCell.cy; sizeLine.cx = m_szCell.cx; sizeLine.cy = m_szCell.cy; @@ -1443,14 +1440,10 @@ PatternRect oldSel = m_Selection; m_Selection = PatternRect(beginSel, endSel); - const CModDoc *pModDoc = GetDocument(); - if(pModDoc != nullptr) + const CSoundFile *pSndFile = GetSoundFile(); + if(pSndFile != nullptr) { - const CSoundFile *pSndFile = pModDoc->GetSoundFile(); - if(pSndFile != nullptr) - { - m_Selection.Sanitize(pSndFile->Patterns[m_nPattern].GetNumRows(), pSndFile->GetNumChannels()); - } + m_Selection.Sanitize(pSndFile->Patterns[m_nPattern].GetNumRows(), pSndFile->GetNumChannels()); } // Get current selection area @@ -1511,10 +1504,9 @@ void CViewPattern::InvalidateRow(ROWINDEX n) //------------------------------------------ { - CModDoc *pModDoc = GetDocument(); - if (pModDoc) + const CSoundFile *pSndFile = GetSoundFile(); + if(pSndFile) { - CSoundFile *pSndFile = pModDoc->GetSoundFile(); int yofs = GetYScrollPos() - m_nMidRow; if (n == ROWINDEX_INVALID) n = GetCurrentRow(); if (((int)n < yofs) || (n >= pSndFile->Patterns[m_nPattern].GetNumRows())) return; @@ -1567,11 +1559,10 @@ void CViewPattern::UpdateIndicator() //---------------------------------- { - CModDoc *pModDoc = GetDocument(); + const CSoundFile *pSndFile = GetSoundFile(); CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - if ((pMainFrm) && (pModDoc)) + if(pMainFrm != nullptr && pSndFile != nullptr) { - CSoundFile *pSndFile = pModDoc->GetSoundFile(); EffectInfo effectInfo(*pSndFile); CHAR s[128]; @@ -1586,7 +1577,7 @@ && (m_Selection.GetUpperLeft() == m_Selection.GetLowerRight()) && (pSndFile->Patterns[m_nPattern]) && (GetCurrentRow() < pSndFile->Patterns[m_nPattern].GetNumRows()) && (nChn < pSndFile->m_nChannels)) { - ModCommand *m = pSndFile->Patterns[m_nPattern].GetpModCommand(GetCurrentRow(), nChn); + const ModCommand *m = pSndFile->Patterns[m_nPattern].GetpModCommand(GetCurrentRow(), nChn); switch(m_Cursor.GetColumnType()) { @@ -1688,13 +1679,10 @@ UINT nChn = GetCurrentChannel(); CString xtraInfo; - CModDoc *pModDoc = GetDocument(); + const CSoundFile *pSndFile = GetSoundFile(); CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - if ((pMainFrm) && (pModDoc)) + if(pMainFrm != nullptr && pSndFile != nullptr) { - CSoundFile *pSndFile = pModDoc->GetSoundFile(); - if (!pSndFile) return; - //xtraInfo.Format("Chan: %d; macro: %X; cutoff: %X; reso: %X; pan: %X", xtraInfo.Format("Chn:%d; Vol:%X; Mac:%X; Cut:%X%s; Res:%X; Pan:%X%s", nChn + 1, @@ -1718,8 +1706,8 @@ //------------------------------------------------------------ { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - CModDoc *pModDoc = GetDocument(); - CSoundFile *pSndFile; + const CModDoc *pModDoc = GetDocument(); + const CSoundFile *pSndFile; CRect rcClient; HDC hdc; BOOL bPlaying; Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2012-12-15 15:25:36 UTC (rev 1461) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2012-12-15 15:45:30 UTC (rev 1462) @@ -276,9 +276,9 @@ for(int c = kcStartChannelKeys; c <= kcEndChannelKeys; c++) newCat.commands.Add(c); newCat.separators.Add(kcEndChannelKeys); //-------------------------------------- - for(int c = kcTransposeUp; c <= kcDataEntryDown; c++) + for(int c = kcBeginTranspose; c <= kcEndTranspose; c++) newCat.commands.Add(c); - newCat.separators.Add(kcDataEntryDown); //-------------------------------------- + newCat.separators.Add(kcEndTranspose); //-------------------------------------- for(int c = kcPatternAmplify; c <= kcPatternShrinkSelection; c++) newCat.commands.Add(c); newCat.separators.Add(kcPatternShrinkSelection); //-------------------------------------- Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2012-12-15 15:25:36 UTC (rev 1461) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2012-12-15 15:45:30 UTC (rev 1462) @@ -2900,8 +2900,8 @@ } -bool CViewPattern::DataEntry(int offset) -//-------------------------------------- +bool CViewPattern::DataEntry(bool up, bool coarse) +//------------------------------------------------ { CSoundFile *pSndFile = GetSoundFile(); if(pSndFile == nullptr || !pSndFile->Patterns.IsValidPat(m_nPattern)) @@ -2919,6 +2919,7 @@ const ModCommand::NOTE noteMax = pSndFile->GetModSpecifications().noteMax; const int instrMax = Util::Min(static_cast<int>(Util::MaxValueOfType(ModCommand::INSTR())), static_cast<int>(pSndFile->GetNumInstruments() ? pSndFile->GetModSpecifications().instrumentsMax : pSndFile->GetModSpecifications().samplesMax)); const EffectInfo effectInfo(*pSndFile); + const int offset = up ? 1 : -1; PrepareUndo(m_Selection); @@ -2932,7 +2933,7 @@ // Increase / decrease note if(m[chn].IsNote()) { - int note = m[chn].note + offset; + int note = m[chn].note + offset * (coarse ? 12 : 1); Limit(note, noteMin, noteMax); m[chn].note = (ModCommand::NOTE)note; } else if(m[chn].note >= NOTE_MIN_SPECIAL) @@ -2948,6 +2949,10 @@ } while(!pSndFile->GetModSpecifications().HasNote((ModCommand::NOTE)note)); if(note >= NOTE_MIN_SPECIAL && note <= NOTE_MAX_SPECIAL) { + if(m[chn].IsPcNote() != ModCommand::IsPcNote((ModCommand::NOTE)note)) + { + m[chn].Clear(); + } m[chn].note = (ModCommand::NOTE)note; } } @@ -2955,7 +2960,7 @@ if(m_Selection.ContainsHorizontal(PatternCursor(0, chn, PatternCursor::instrColumn))) { // Increase / decrease instrument - int instr = m[chn].instr + offset; + int instr = m[chn].instr + offset * (coarse ? 10 : 1); if(m[chn].IsInstrPlug()) { Limit(instr, 0, int(MAX_MIXPLUGINS)); @@ -2970,12 +2975,12 @@ // Increase / decrease volume parameter if(m[chn].IsPcNote()) { - int val = m[chn].GetValueVolCol() + offset; + int val = m[chn].GetValueVolCol() + offset * (coarse ? 10 : 1); Limit(val, 0, int(ModCommand::maxColumnValue)); m[chn].SetValueVolCol(val); } else { - int vol = m[chn].vol + offset; + int vol = m[chn].vol + offset * (coarse ? 10 : 1); DWORD minValue = 0, maxValue = 64; effectInfo.GetVolCmdInfo(effectInfo.GetIndexFromVolCmd(m[chn].volcmd), nullptr, &minValue, &maxValue); Limit(vol, (int)minValue, (int)maxValue); @@ -2987,12 +2992,12 @@ // Increase / decrease effect parameter if(m[chn].IsPcNote()) { - int val = m[chn].GetValueEffectCol() + offset; + int val = m[chn].GetValueEffectCol() + offset * (coarse ? 10 : 1); Limit(val, 0, int(ModCommand::maxColumnValue)); m[chn].SetValueEffectCol(val); } else { - int param = m[chn].param + offset; + int param = m[chn].param + offset * (coarse ? 16 : 1); DWORD minValue = 0, maxValue = 0xFF; effectInfo.GetEffectInfo(effectInfo.GetIndexFromEffect(m[chn].command, m[chn].param), nullptr, false, &minValue, &maxValue); Limit(param, (int)minValue, (int)maxValue); @@ -4161,8 +4166,10 @@ case kcTransposeOctUp: OnTransposeOctUp(); return wParam; case kcTransposeOctDown: OnTransposeOctDown(); return wParam; case kcTransposeCustom: OnTransposeCustom(); return wParam; - case kcDataEntryUp: DataEntry(1); return wParam; - case kcDataEntryDown: DataEntry(-1); return wParam; + case kcDataEntryUp: DataEntry(true, false); return wParam; + case kcDataEntryDown: DataEntry(false, false); return wParam; + case kcDataEntryUpCoarse: DataEntry(true, true); return wParam; + case kcDataEntryDownCoarse: DataEntry(false, true); return wParam; case kcSelectColumn: OnSelectCurrentColumn(); return wParam; case kcPatternAmplify: OnPatternAmplify(); return wParam; case kcPatternSetInstrument: OnSetSelInstrument(); return wParam; Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2012-12-15 15:25:36 UTC (rev 1461) +++ trunk/OpenMPT/mptrack/View_pat.h 2012-12-15 15:45:30 UTC (rev 1462) @@ -256,7 +256,7 @@ void MoveCursor(bool moveRight); bool TransposeSelection(int transp); - bool DataEntry(int offset); + bool DataEntry(bool up, bool coarse); bool PrepareUndo(const PatternRect &selection) { return PrepareUndo(selection.GetUpperLeft(), selection.GetLowerRight()); }; bool PrepareUndo(const PatternCursor &beginSel, const PatternCursor &endSel); @@ -266,7 +266,7 @@ void ProcessChar(UINT nChar, UINT nFlags); public: - void DrawPatternData(HDC hdc, CSoundFile *pSndFile, PATTERNINDEX nPattern, bool selEnable, bool isPlaying, ROWINDEX startRow, ROWINDEX numRows, CHANNELINDEX startChan, CRect &rcClient, int *pypaint); + void DrawPatternData(HDC hdc, const CSoundFile *pSndFile, PATTERNINDEX nPattern, bool selEnable, bool isPlaying, ROWINDEX startRow, ROWINDEX numRows, CHANNELINDEX startChan, CRect &rcClient, int *pypaint); void DrawLetter(int x, int y, char letter, int sizex=10, int ofsx=0); void DrawNote(int x, int y, UINT note, CTuning* pTuning = NULL); void DrawInstrument(int x, int y, UINT instr); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |