From: <rel...@us...> - 2009-06-06 18:49:54
|
Revision: 262 http://modplug.svn.sourceforge.net/modplug/?rev=262&view=rev Author: relabsoluness Date: 2009-06-06 18:49:52 +0000 (Sat, 06 Jun 2009) Log Message: ----------- Pattern tab: + Channel reset(stops note, sets initial chn settings). Available from channel header context menu and new key binding. . Fixed wrong interpretations of "Old style pattern context menu"-option. / Channel control context menu will now be visible only in channel header context. Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/mptrack/resource.h Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2009-06-06 18:40:29 UTC (rev 261) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2009-06-06 18:49:52 UTC (rev 262) @@ -2299,6 +2299,11 @@ commands[kcSampleSignUnsign].isHidden = false; commands[kcSampleSignUnsign].isDummy = false; + commands[kcChannelReset].UID = 1786; + commands[kcChannelReset].isHidden = false; + commands[kcChannelReset].isDummy = false; + commands[kcChannelReset].Message = "Reset channel"; + #ifdef _DEBUG for (int i=0; i<kcNumCommands; i++) { if (commands[i].UID != 0) { // ignore unset UIDs Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2009-06-06 18:40:29 UTC (rev 261) +++ trunk/OpenMPT/mptrack/CommandSet.h 2009-06-06 18:49:52 UTC (rev 262) @@ -230,6 +230,7 @@ kcToggleChanMuteOnPatTransition, kcUnmuteAllChnOnPatTransition, kcSoloChnOnPatTransition, + kcChannelReset, kcCopyAndLoseSelection, kcTransposeUp, kcTransposeDown, Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2009-06-06 18:40:29 UTC (rev 261) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2009-06-06 18:49:52 UTC (rev 262) @@ -229,9 +229,9 @@ for (int c=kcClearRow; c<=kcInsertAllRows; c++) newCat->commands.Add(c); newCat->separators.Add(kcInsertAllRows); //-------------------------------------- - for (int c=kcChannelMute; c<=kcSoloChnOnPatTransition; c++) + for (int c=kcChannelMute; c<=kcChannelReset; c++) newCat->commands.Add(c); - newCat->separators.Add(kcSoloChnOnPatTransition); //-------------------------------------- + newCat->separators.Add(kcChannelReset); //-------------------------------------- for (int c=kcTransposeUp; c<=kcTransposeOctDown; c++) newCat->commands.Add(c); newCat->separators.Add(kcTransposeOctDown); //-------------------------------------- Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2009-06-06 18:40:29 UTC (rev 261) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-06-06 18:49:52 UTC (rev 262) @@ -66,6 +66,7 @@ ON_COMMAND(ID_EDIT_SPLITRECSELECT, OnSplitRecordSelect) // -! NEW_FEATURE#0012 ON_COMMAND(ID_EDIT_UNDO, OnEditUndo) + ON_COMMAND(ID_PATTERN_CHNRESET, OnChannelReset) ON_COMMAND(ID_PATTERN_MUTE, OnMuteFromClick) //rewbs.customKeys ON_COMMAND(ID_PATTERN_SOLO, OnSoloFromClick) //rewbs.customKeys ON_COMMAND(ID_PATTERN_TRANSITIONMUTE, OnTogglePendingMuteFromClick) @@ -1218,8 +1219,8 @@ //------ Standard Menu ---------- : else if ((pt.x >= m_szHeader.cx) && (pt.y > m_szHeader.cy)) { - if (BuildSoloMuteCtxMenu(hMenu, ih, nChn, pSndFile)) - AppendMenu(hMenu, MF_SEPARATOR, 0, ""); + /*if (BuildSoloMuteCtxMenu(hMenu, ih, nChn, pSndFile)) + AppendMenu(hMenu, MF_SEPARATOR, 0, "");*/ if (BuildSelectionCtxMenu(hMenu, ih)) AppendMenu(hMenu, MF_SEPARATOR, 0, ""); if (BuildEditCtxMenu(hMenu, ih, pModDoc)) @@ -1376,8 +1377,23 @@ } } +void CViewPattern::OnChannelReset() +//--------------------------------- +{ + const CHANNELINDEX nChn = GetChanFromCursor(m_nMenuParam); + CModDoc *pModDoc = GetDocument(); + CSoundFile* pSndFile; + if (pModDoc == 0 || (pSndFile = pModDoc->GetSoundFile()) == 0) return; + const bool bIsMuted = pModDoc->IsChannelMuted(nChn); + if(!bIsMuted) pModDoc->MuteChannel(nChn, true); + pSndFile->ResetChannelState(nChn, CHNRESET_TOTAL); + if(!bIsMuted) pModDoc->MuteChannel(nChn, false); +} + + void CViewPattern::OnMuteFromClick() +//---------------------------------- { OnMuteChannel(false); } @@ -3328,6 +3344,7 @@ case kcChannelUnmuteAll: OnUnmuteAll(); return wParam; case kcToggleChanMuteOnPatTransition: TogglePendingMute(GetChanFromCursor(m_dwCursor)); return wParam; case kcUnmuteAllChnOnPatTransition: OnPendingUnmuteAllChnFromClick(); return wParam; + case kcChannelReset: OnChannelReset(); return wParam; case kcTimeAtRow: OnShowTimeAtRow(); return wParam; case kcSoloChnOnPatTransition: PendingSoloChn(GetCurrentChannel()); return wParam; case kcTransposeUp: OnTransposeUp(); return wParam; @@ -4486,6 +4503,8 @@ AppendMenu(hMenu, MF_STRING, ID_PATTERN_TRANSITION_UNMUTEALL, "On transition: Unmute all\t" + ih->GetKeyTextFromCommand(kcUnmuteAllChnOnPatTransition)); AppendMenu(hMenu, MF_STRING, ID_PATTERN_TRANSITIONSOLO, "On transition: Solo\t" + ih->GetKeyTextFromCommand(kcSoloChnOnPatTransition)); + + AppendMenu(hMenu, MF_STRING, ID_PATTERN_CHNRESET, "Reset Channel\t" + ih->GetKeyTextFromCommand(kcChannelReset)); return true; } @@ -4518,11 +4537,8 @@ bool CViewPattern::BuildMiscCtxMenu(HMENU hMenu, CInputHandler* ih) //----------------------------------------------------------------- { - if (CMainFrame::m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE) return false; - AppendMenu(hMenu, MF_STRING, ID_SHOWTIMEATROW, "Show row play time\t" + ih->GetKeyTextFromCommand(kcTimeAtRow)); return true; - } bool CViewPattern::BuildSelectionCtxMenu(HMENU hMenu, CInputHandler* ih) @@ -4701,9 +4717,6 @@ bool CViewPattern::BuildChannelControlCtxMenu(HMENU hMenu) //-------------------------------------------------------------------- { - if (CMainFrame::m_dwPatternSetup&PATTERN_OLDCTXMENUSTYLE) return false; - //Not doing the menuentries if opted to use old style menu style. - AppendMenu(hMenu, MF_SEPARATOR, 0, ""); AppendMenu(hMenu, MF_STRING, ID_PATTERN_DUPLICATECHANNEL, "Duplicate this channel"); @@ -4729,11 +4742,8 @@ CArray<UINT, UINT> validChans; DWORD greyed = (ListChansWhereColSelected(INST_COLUMN, validChans)>0)?FALSE:MF_GRAYED; - if (CMainFrame::m_dwPatternSetup&PATTERN_OLDCTXMENUSTYLE && (!greyed)) { - // Case: User has opted to use old style menu style. - AppendMenu(hMenu, MF_STRING, ID_PATTERN_SETINSTRUMENT, "Change Instrument\t" + ih->GetKeyTextFromCommand(kcPatternSetInstrument)); - } - else { + if (!greyed || !(CMainFrame::m_dwPatternSetup&PATTERN_OLDCTXMENUSTYLE)) + { // Create the new menu and add it to the existing menu. HMENU instrumentChangeMenu = ::CreatePopupMenu(); AppendMenu(hMenu, MF_POPUP|greyed, (UINT)instrumentChangeMenu, "Change Instrument\t" + ih->GetKeyTextFromCommand(kcPatternSetInstrument)); @@ -4741,32 +4751,39 @@ if(pSndFile == NULL) return false; + if(!greyed) + { + if (pSndFile->m_nInstruments) + { + for (UINT i=1; i<=pSndFile->m_nInstruments; i++) + { + if (pSndFile->Headers[i] == NULL) + continue; - if (pSndFile->m_nInstruments) { - for (UINT i=1; i<=pSndFile->m_nInstruments; i++) { - if (pSndFile->Headers[i] == NULL) { - continue; - } CString instString = pSndFile->GetPatternViewInstrumentName(i, true); if(instString.GetLength() > 0) AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT+i, pSndFile->GetPatternViewInstrumentName(i)); //Adding the entry to the list only if it has some name, since if the name is empty, //it likely is some non-used instrument. } - } else { + } + else + { CHAR s[256]; UINT nmax = pSndFile->m_nSamples; while ((nmax > 1) && (pSndFile->Ins[nmax].pSample == NULL) && (!pSndFile->m_szNames[nmax][0])) nmax--; - for (UINT i=1; i<=nmax; i++) if ((pSndFile->m_szNames[i][0]) || (pSndFile->Ins[i].pSample)) { + for (UINT i=1; i<=nmax; i++) if ((pSndFile->m_szNames[i][0]) || (pSndFile->Ins[i].pSample)) + { wsprintf(s, "%02d: %s", i, pSndFile->m_szNames[i]); AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT+i, s); } } - //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"); + //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"); + } return true; } return false; Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2009-06-06 18:40:29 UTC (rev 261) +++ trunk/OpenMPT/mptrack/View_pat.h 2009-06-06 18:49:52 UTC (rev 262) @@ -228,6 +228,7 @@ afx_msg void OnEditGoto(); afx_msg void OnEditFindNext(); afx_msg void OnEditUndo(); + afx_msg void OnChannelReset(); afx_msg void OnMuteFromClick(); //rewbs.customKeys afx_msg void OnSoloFromClick(); //rewbs.customKeys afx_msg void OnTogglePendingMuteFromClick(); //rewbs.customKeys Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2009-06-06 18:40:29 UTC (rev 261) +++ trunk/OpenMPT/mptrack/resource.h 2009-06-06 18:49:52 UTC (rev 262) @@ -961,6 +961,7 @@ #define ID_PATTERN_PLAYNOLOOP 32901 #define ID_PATTERN_OPEN_RANDOMIZER 32905 #define ID_PATTERN_INTERPOLATE_NOTE 32906 +#define ID_PATTERN_CHNRESET 32907 #define ID_PRESET_LOAD 32915 #define ID_PRESET_SAVE 32916 #define ID_PRESET_RANDOM 32917 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |