From: <sag...@us...> - 2012-11-16 22:34:29
|
Revision: 1427 http://modplug.svn.sourceforge.net/modplug/?rev=1427&view=rev Author: saga-games Date: 2012-11-16 22:34:22 +0000 (Fri, 16 Nov 2012) Log Message: ----------- [New] Pattern Editor: Added "Data Entry +/- 1" shortcuts in pattern editor, to increase or decrease the value of the currently selected pattern cells by one (experimental). [Imp] Pattern Editor: Added shortcuts for Record Select / Split Record Select (tx DJBouche). Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2012-11-14 23:43:41 UTC (rev 1426) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2012-11-16 22:34:22 UTC (rev 1427) @@ -635,6 +635,10 @@ DefineKeyCommand(kcChnSettingsClose, 1880, _T("Switch to Pattern Editor")); DefineKeyCommand(kcTransposeCustom, 1881, _T("Transpose Custom")); DefineKeyCommand(kcSampleZoomSelection, 1882, _T("Zoom into Selection")); + DefineKeyCommand(kcChannelRecordSelect, 1883, _T("Channel Record Select")); + DefineKeyCommand(kcChannelSplitRecordSelect, 1884, _T("Channel Split Record Select")); + DefineKeyCommand(kcDataEntryUp, 1885, _T("Data Entry +1")); + DefineKeyCommand(kcDataEntryDown, 1886, _T("Data Entry -1")); // Add new key commands here. #ifdef _DEBUG Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2012-11-14 23:43:41 UTC (rev 1426) +++ trunk/OpenMPT/mptrack/CommandSet.h 2012-11-16 22:34:22 UTC (rev 1427) @@ -259,6 +259,8 @@ kcToggleChanMuteOnPatTransition, kcUnmuteAllChnOnPatTransition, kcSoloChnOnPatTransition, + kcChannelRecordSelect, + kcChannelSplitRecordSelect, kcChannelReset, kcChannelSettings, kcEndChannelKeys = kcChannelSettings, Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2012-11-14 23:43:41 UTC (rev 1426) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2012-11-16 22:34:22 UTC (rev 1427) @@ -2699,7 +2699,7 @@ const ModCommand srcCmd = *sndFile->Patterns[m_nPattern].GetpModCommand(row0, nchn); const ModCommand destCmd = *sndFile->Patterns[m_nPattern].GetpModCommand(row1, nchn); - ModCommand::NOTE PCnote = 0; + ModCommand::NOTE PCnote = NOTE_NONE; uint16 PCinst = 0, PCparam = 0; switch(type) @@ -2877,8 +2877,7 @@ { if (m[chn].IsNote()) { - int note = m[chn].note; - note += transp; + int note = m[chn].note + transp; Limit(note, noteMin, noteMax); m[chn].note = (ModCommand::NOTE)note; } @@ -2890,6 +2889,92 @@ } +bool CViewPattern::DataEntry(int offset) +//-------------------------------------- +{ + CSoundFile *pSndFile = GetSoundFile(); + if(pSndFile == nullptr || !pSndFile->Patterns.IsValidPat(m_nPattern)) + { + return false; + } + + m_Selection.Sanitize(pSndFile->Patterns[m_nPattern].GetNumRows(), pSndFile->GetNumChannels()); + + const ROWINDEX startRow = m_Selection.GetStartRow(), endRow = m_Selection.GetEndRow(); + const CHANNELINDEX startChan = m_Selection.GetStartChannel(), endChan = m_Selection.GetEndChannel(); + + // Don't allow notes outside our supported note range. + const ModCommand::NOTE noteMin = pSndFile->GetModSpecifications().noteMin; + 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); + + PrepareUndo(m_Selection); + + for(ROWINDEX row = startRow; row <= endRow; row++) + { + PatternRow m = pSndFile->Patterns[m_nPattern].GetRow(row); + for(CHANNELINDEX chn = startChan; chn <= endChan; chn++) + { + if(m_Selection.ContainsHorizontal(PatternCursor(0, chn, PatternCursor::noteColumn)) && m[chn].IsNote()) + { + int note = m[chn].note + offset; + Limit(note, noteMin, noteMax); + m[chn].note = (ModCommand::NOTE)note; + } + if(m_Selection.ContainsHorizontal(PatternCursor(0, chn, PatternCursor::instrColumn))) + { + int instr = m[chn].instr + offset; + if(m[chn].IsInstrPlug()) + { + Limit(instr, 0, int(MAX_MIXPLUGINS)); + } else + { + Limit(instr, 0, instrMax); + } + m[chn].instr = (ModCommand::INSTR)instr; + } + if(m_Selection.ContainsHorizontal(PatternCursor(0, chn, PatternCursor::volumeColumn))) + { + if(m[chn].IsPcNote()) + { + int val = m[chn].GetValueVolCol() + offset; + Limit(val, 0, int(ModCommand::maxColumnValue)); + m[chn].SetValueVolCol(val); + } else + { + int vol = m[chn].vol + offset; + DWORD minValue = 0, maxValue = 64; + effectInfo.GetVolCmdInfo(effectInfo.GetIndexFromVolCmd(m[chn].volcmd), nullptr, &minValue, &maxValue); + Limit(vol, (int)minValue, (int)maxValue); + m[chn].vol = (ModCommand::VOL)vol; + } + } + if(m_Selection.ContainsHorizontal(PatternCursor(0, chn, PatternCursor::effectColumn)) || m_Selection.ContainsHorizontal(PatternCursor(0, chn, PatternCursor::paramColumn))) + { + if(m[chn].IsPcNote()) + { + int val = m[chn].GetValueEffectCol() + offset; + Limit(val, 0, int(ModCommand::maxColumnValue)); + m[chn].SetValueEffectCol(val); + } else + { + int param = m[chn].param + offset; + 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); + m[chn].param = (ModCommand::PARAM)param; + } + } + } + } + + SetModified(false); + InvalidatePattern(); + return true; +} + + void CViewPattern::OnDropSelection() //---------------------------------- { @@ -4032,6 +4117,8 @@ case kcChannelUnmuteAll: OnUnmuteAll(); return wParam; case kcToggleChanMuteOnPatTransition: TogglePendingMute(GetCurrentChannel()); return wParam; case kcUnmuteAllChnOnPatTransition: OnPendingUnmuteAllChnFromClick(); return wParam; + case kcChannelRecordSelect: pModDoc->Record1Channel(m_Cursor.GetChannel()); InvalidateChannelsHeaders(); return wParam; + case kcChannelSplitRecordSelect: pModDoc->Record2Channel(m_Cursor.GetChannel()); InvalidateChannelsHeaders(); return wParam; case kcChannelReset: ResetChannel(m_Cursor.GetChannel()); return wParam; case kcTimeAtRow: OnShowTimeAtRow(); return wParam; case kcSoloChnOnPatTransition: PendingSoloChn(GetCurrentChannel()); return wParam; @@ -4040,6 +4127,8 @@ 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 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-11-14 23:43:41 UTC (rev 1426) +++ trunk/OpenMPT/mptrack/View_pat.h 2012-11-16 22:34:22 UTC (rev 1427) @@ -254,6 +254,7 @@ void MoveCursor(bool moveRight); bool TransposeSelection(int transp); + bool DataEntry(int offset); bool PrepareUndo(const PatternRect &selection) { return PrepareUndo(selection.GetUpperLeft(), selection.GetLowerRight()); }; bool PrepareUndo(const PatternCursor &beginSel, const PatternCursor &endSel); Modified: trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb =================================================================== --- trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb 2012-11-14 23:43:41 UTC (rev 1426) +++ trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb 2012-11-16 22:34:22 UTC (rev 1427) @@ -95,6 +95,8 @@ 2:1005:0:121:1 //Mute current Channel: F10 (KeyDown) 2:1006:2:121:1 //Solo current Channel: Ctrl+F10 (KeyDown) 2:1771:6:121:1 //Unmute all channels: Ctrl+Alt+F10 (KeyDown) +2:1883:2:49:1 //Channel Record Select: Ctrl+1 (KeyDown) +2:1884:2:50:1 //Channel Split Record Select: Ctrl+2 (KeyDown) 2:1786:2:82:1 //Reset Channel: Ctrl+R (KeyDown) 2:1007:2:81:5 //Transpose +1: Ctrl+Q (KeyDown|KeyHold) 2:1008:2:65:5 //Transpose -1: Ctrl+A (KeyDown|KeyHold) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2012-11-14 23:43:41 UTC (rev 1426) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2012-11-16 22:34:22 UTC (rev 1427) @@ -98,6 +98,8 @@ 2:1819:2:69:1 //Split Keyboard Settings dialog: Ctrl+E (KeyDown) 2:1780:2:80:1 //Show playback time at current row: Ctrl+P (KeyDown) 2:1005:2:85:1 //Mute current Channel: Ctrl+U (KeyDown) +2:1883:2:49:1 //Channel Record Select: Ctrl+1 (KeyDown) +2:1884:2:50:1 //Channel Split Record Select: Ctrl+2 (KeyDown) 2:1786:2:82:1 //Reset Channel: Ctrl+R (KeyDown) 2:1007:2:81:5 //Transpose +1: Ctrl+Q (KeyDown|KeyHold) 2:1008:2:65:5 //Transpose -1: Ctrl+A (KeyDown|KeyHold) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |