From: <sag...@us...> - 2014-06-29 19:59:31
|
Revision: 4180 http://sourceforge.net/p/modplug/code/4180 Author: saga-games Date: 2014-06-29 19:59:23 +0000 (Sun, 29 Jun 2014) Log Message: ----------- [Imp] Pattern tab: "Edit Plugin assigned to PC Event" shortcut is now "Toggle PC Event/instrument plugin editor" (can now also be used to toggle the editor of the plugin assigned to the currently selected instrument). Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2014-06-29 17:00:59 UTC (rev 4179) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2014-06-29 19:59:23 UTC (rev 4180) @@ -590,7 +590,7 @@ DefineKeyCommand(kcInstrumentEnvelopeToggleReleaseNode, 1833, _T("Toggle release node")); DefineKeyCommand(kcInstrumentEnvelopePointMoveUp8, 1834, _T("Move envelope point up (Coarse)")); DefineKeyCommand(kcInstrumentEnvelopePointMoveDown8, 1835, _T("Move envelope point down (Coarse)")); - DefineKeyCommand(kcPatternEditPCNotePlugin, 1836, _T("Edit Plugin assigned to PC Event")); + DefineKeyCommand(kcPatternEditPCNotePlugin, 1836, _T("Toggle PC Event/instrument plugin editor")); DefineKeyCommand(kcInstrumentEnvelopeZoomIn, 1837, _T("Zoom In")); DefineKeyCommand(kcInstrumentEnvelopeZoomOut, 1838, _T("Zoom Out")); DefineKeyCommand(kcVSTGUIToggleRecordParams, 1839, _T("Toggle Parameter Recording")); Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2014-06-29 17:00:59 UTC (rev 4179) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2014-06-29 19:59:23 UTC (rev 4180) @@ -6288,7 +6288,6 @@ return false; } - std::vector<CHANNELINDEX> validChans; DWORD greyed = IsColumnSelected(PatternCursor::instrColumn) ? 0 : MF_GRAYED; @@ -6344,7 +6343,7 @@ AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT, "Remove instrument"); AppendMenu(instrumentChangeMenu, MF_STRING, ID_CHANGE_INSTRUMENT + GetCurrentInstrument(), "Set to current instrument"); } - return true; + return BuildTogglePlugEditorCtxMenu(hMenu, ih); } return false; } @@ -6397,15 +6396,44 @@ { AppendMenu(paramChangeMenu, MF_STRING | (i == curParam) ? MF_CHECKED : 0, ID_CHANGE_PCNOTE_PARAM + i, plug->GetFormattedParamName(i)); } - } + } + } + return BuildTogglePlugEditorCtxMenu(hMenu, ih); +} + + +bool CViewPattern::BuildTogglePlugEditorCtxMenu(HMENU hMenu, CInputHandler *ih) const +//----------------------------------------------------------------------------------- +{ + const CSoundFile *sndFile = GetSoundFile(); + if(sndFile == nullptr || !sndFile->Patterns.IsValidPat(m_nPattern)) + { + return false; + } + + PLUGINDEX plug = 0; + const ModCommand &selStart = *sndFile->Patterns[m_nPattern].GetpModCommand(m_Selection.GetStartRow(), m_Selection.GetStartChannel()); + if(selStart.IsPcNote()) + { + // PC Event + plug = selStart.instr; + } else if(selStart.instr > 0 && selStart.instr <= sndFile->GetNumInstruments() + && sndFile->Instruments[selStart.instr] != nullptr + && sndFile->Instruments[selStart.instr]->nMixPlug) + { + // Regular instrument + plug = sndFile->Instruments[selStart.instr]->nMixPlug; + } + + if(plug && plug <= MAX_MIXPLUGINS && sndFile->m_MixPlugins[plug - 1].pMixPlugin != nullptr) + { AppendMenu(hMenu, MF_STRING, ID_PATTERN_EDIT_PCNOTE_PLUGIN, "Toggle Plugin Editor\t" + ih->GetKeyTextFromCommand(kcPatternEditPCNotePlugin)); + return true; } - - return true; + return false; } - // Returns an ordered list of all channels in which a given column type is selected. CHANNELINDEX CViewPattern::ListChansWhereColSelected(PatternCursor::Columns colType, std::vector<CHANNELINDEX> &chans) const //-------------------------------------------------------------------------------------------------------------------------- Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2014-06-29 17:00:59 UTC (rev 4179) +++ trunk/OpenMPT/mptrack/View_pat.h 2014-06-29 19:59:23 UTC (rev 4180) @@ -471,6 +471,7 @@ bool BuildSetInstCtxMenu(HMENU hMenu, CInputHandler *ih) const; bool BuildAmplifyCtxMenu(HMENU hMenu, CInputHandler *ih) const; bool BuildPCNoteCtxMenu(HMENU hMenu, CInputHandler *ih) const; + bool BuildTogglePlugEditorCtxMenu(HMENU hMenu, CInputHandler *ih) const; // Returns an ordered list of all channels in which a given column type is selected. CHANNELINDEX ListChansWhereColSelected(PatternCursor::Columns colType, std::vector<CHANNELINDEX> &chans) const; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |