From: <sag...@us...> - 2010-02-20 23:14:07
|
Revision: 504 http://modplug.svn.sourceforge.net/modplug/?rev=504&view=rev Author: saga-games Date: 2010-02-20 23:13:54 +0000 (Sat, 20 Feb 2010) Log Message: ----------- [New] Pattern Editor: Key shortcut + context menu entry for toggling the plugin editor of the PC note that's under the cursor. 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/resource.h Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2010-02-20 21:02:02 UTC (rev 503) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2010-02-20 23:13:54 UTC (rev 504) @@ -2560,6 +2560,11 @@ commands[kcInstrumentEnvelopePointMoveDown8].isDummy = false; commands[kcInstrumentEnvelopePointMoveDown8].Message = "Move envelope point down (big step)"; + commands[kcPatternEditPCNotePlugin].UID = 1836; + commands[kcPatternEditPCNotePlugin].isHidden = false; + commands[kcPatternEditPCNotePlugin].isDummy = false; + commands[kcPatternEditPCNotePlugin].Message = "Edit plugin assigned to PC note"; + #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 2010-02-20 21:02:02 UTC (rev 503) +++ trunk/OpenMPT/mptrack/CommandSet.h 2010-02-20 23:13:54 UTC (rev 504) @@ -221,6 +221,7 @@ kcSwitchToOrderList, kcNewPattern, kcDuplicatePattern, + kcPatternEditPCNotePlugin, kcTogglePluginEditor, kcShowNoteProperties, kcShowPatternProperties, Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-02-20 21:02:02 UTC (rev 503) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-02-20 23:13:54 UTC (rev 504) @@ -114,6 +114,7 @@ ON_COMMAND(ID_CLEAR_SELECTION, OnClearSelectionFromMenu) ON_COMMAND(ID_SHOWTIMEATROW, OnShowTimeAtRow) ON_COMMAND(ID_CHANNEL_RENAME, OnRenameChannel) + ON_COMMAND(ID_PATTERN_EDIT_PCNOTE_PLUGIN, OnTogglePCNotePluginEditor) ON_COMMAND_RANGE(ID_CHANGE_INSTRUMENT, ID_CHANGE_INSTRUMENT+MAX_INSTRUMENTS, OnSelectInstrument) ON_UPDATE_COMMAND_UI(ID_EDIT_UNDO, OnUpdateUndo) ON_COMMAND_RANGE(ID_PLUGSELECT, ID_PLUGSELECT+MAX_MIXPLUGINS, OnSelectPlugin) //rewbs.patPlugName @@ -1225,7 +1226,8 @@ AppendMenu(hMenu, MF_SEPARATOR, 0, ""); if (BuildVisFXCtxMenu(hMenu, ih) | //Use bitwise ORs to avoid shortcuts BuildAmplifyCtxMenu(hMenu, ih) | - BuildSetInstCtxMenu(hMenu, ih, pSndFile) ) + BuildSetInstCtxMenu(hMenu, ih, pSndFile) | + BuildPCNoteCtxMenu(hMenu, ih, pSndFile) ) AppendMenu(hMenu, MF_SEPARATOR, 0, ""); if (BuildGrowShrinkCtxMenu(hMenu, ih)) AppendMenu(hMenu, MF_SEPARATOR, 0, ""); @@ -3620,6 +3622,7 @@ case kcDuplicatePattern: SendCtrlMessage(CTRLMSG_PAT_DUPPATTERN); return wParam; case kcSwitchToOrderList: OnSwitchToOrderList(); case kcSwitchOverflowPaste: CMainFrame::m_dwPatternSetup ^= PATTERN_OVERFLOWPASTE; return wParam; + case kcPatternEditPCNotePlugin: OnTogglePCNotePluginEditor(); return wParam; } //Ranges: @@ -4988,6 +4991,23 @@ } +bool CViewPattern::BuildPCNoteCtxMenu(HMENU hMenu, CInputHandler* ih, CSoundFile* pSndFile) +//----------------------------------------------------------------------------------------- +{ + MODCOMMAND *mSelStart = nullptr; + if((pSndFile == nullptr) || (!pSndFile->Patterns.IsValidPat(m_nPattern))) + return false; + mSelStart = pSndFile->Patterns[m_nPattern].GetpModCommand(GetSelectionStartRow(), GetSelectionStartChan()); + if((mSelStart == nullptr) || (!mSelStart->IsPcNote())) + return false; + if(mSelStart->instr < 1 || mSelStart->instr > MAX_MIXPLUGINS) + return false; + + AppendMenu(hMenu, MF_STRING, ID_PATTERN_EDIT_PCNOTE_PLUGIN, "Toggle plugin editor\t" + ih->GetKeyTextFromCommand(kcPatternEditPCNotePlugin)); + return true; +} + + UINT CViewPattern::GetSelectionStartRow() { //----------------------------------------- return min(GetRowFromCursor(m_dwBeginSel), GetRowFromCursor(m_dwEndSel)); @@ -5232,3 +5252,24 @@ SetFocus(); } } + + +void CViewPattern::OnTogglePCNotePluginEditor() +//--------------------------------------------- +{ + CModDoc *pModDoc = GetDocument(); + if(pModDoc == nullptr) return; + CSoundFile *pSndFile = pModDoc->GetSoundFile(); + if((pSndFile == nullptr) || (!pSndFile->Patterns.IsValidPat(m_nPattern))) + return; + + MODCOMMAND *mSelStart = nullptr; + mSelStart = pSndFile->Patterns[m_nPattern].GetpModCommand(GetSelectionStartRow(), GetSelectionStartChan()); + if((mSelStart == nullptr) || (!mSelStart->IsPcNote())) + return; + if(mSelStart->instr < 1 || mSelStart->instr > MAX_MIXPLUGINS) + return; + + PLUGINDEX nPlg = (PLUGINDEX)(mSelStart->instr - 1); + pModDoc->TogglePluginEditor(nPlg); +} Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2010-02-20 21:02:02 UTC (rev 503) +++ trunk/OpenMPT/mptrack/View_pat.h 2010-02-20 23:13:54 UTC (rev 504) @@ -303,6 +303,7 @@ afx_msg void OnRunScript(); afx_msg void OnShowTimeAtRow(); afx_msg void OnRenameChannel(); + afx_msg void OnTogglePCNotePluginEditor(); //}}AFX_MSG DECLARE_MESSAGE_MAP() @@ -331,6 +332,7 @@ bool BuildSetInstCtxMenu(HMENU hMenu, CInputHandler* ih, CSoundFile* pSndFile); bool BuildAmplifyCtxMenu(HMENU hMenu, CInputHandler* ih); bool BuildChannelMiscCtxMenu(HMENU hMenu, CSoundFile* pSndFile); + bool BuildPCNoteCtxMenu(HMENU hMenu, CInputHandler* ih, CSoundFile* pSndFile); UINT GetSelectionStartRow(); UINT GetSelectionEndRow(); Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2010-02-20 21:02:02 UTC (rev 503) +++ trunk/OpenMPT/mptrack/resource.h 2010-02-20 23:13:54 UTC (rev 504) @@ -1202,6 +1202,7 @@ #define ID_SAMPLE_GENERATE 60445 #define ID_NOTEMAP_TRANS_UP 60446 #define ID_NOTEMAP_TRANS_DOWN 60447 +#define ID_PATTERN_EDIT_PCNOTE_PLUGIN 60448 // Next default values for new objects // @@ -1209,7 +1210,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 526 -#define _APS_NEXT_COMMAND_VALUE 60448 +#define _APS_NEXT_COMMAND_VALUE 60449 #define _APS_NEXT_CONTROL_VALUE 2427 #define _APS_NEXT_SYMED_VALUE 901 #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |