From: <sv...@op...> - 2024-09-19 13:30:39
|
Author: sagamusix Date: Thu Sep 19 15:30:32 2024 New Revision: 21624 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21624 Log: [Mod] Implement custom context menu key handling through regular keyboard handling instead of special-casing it everywhere. [Mod] In addition to the Application key, custom context menu key handling now adds Shift+F10 as a default shortcut, which is what Windows uses by default as a substitute for keyboards without an Application key (https://bugs.openmpt.org/view.php?id=1815). [Mod] OpenMPT: Version is now 1.32.00.25 Modified: trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainbar.cpp trunk/OpenMPT/mptrack/Mainbar.h trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_tre.cpp Modified: trunk/OpenMPT/common/versionNumber.h ============================================================================== --- trunk/OpenMPT/common/versionNumber.h Thu Sep 19 15:05:51 2024 (r21623) +++ trunk/OpenMPT/common/versionNumber.h Thu Sep 19 15:30:32 2024 (r21624) @@ -16,4 +16,4 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 32 #define VER_MINOR 00 -#define VER_MINORMINOR 24 +#define VER_MINORMINOR 25 Modified: trunk/OpenMPT/mptrack/CommandSet.cpp ============================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp Thu Sep 19 15:05:51 2024 (r21623) +++ trunk/OpenMPT/mptrack/CommandSet.cpp Thu Sep 19 15:30:32 2024 (r21624) @@ -89,6 +89,8 @@ {kcViewMIDImapping, VK_F3, ModCtrl, kKeyEventDown, kCtxAllContexts, MPT_V("1.31")}, {kcSwitchToInstrLibrary, 'I', ModAlt, kKeyEventDown | kKeyEventRepeat, kCtxAllContexts, MPT_V("1.31")}, {kcHelp, VK_F1, ModNone, kKeyEventDown, kCtxAllContexts, MPT_V("1.31")}, + {kcContextMenu, VK_APPS, ModNone, kKeyEventDown, kCtxAllContexts, MPT_V("1.32.00.25")}, + {kcContextMenu, VK_F10, ModShift, kKeyEventDown, kCtxAllContexts, MPT_V("1.32.00.25")}, {kcPrevInstrument, VK_DIVIDE, ModCtrl, kKeyEventDown | kKeyEventRepeat, kCtxAllContexts, MPT_V("1.31")}, {kcPrevInstrument, VK_UP, ModCtrl, kKeyEventDown | kKeyEventRepeat, kCtxAllContexts, MPT_V("1.31")}, {kcNextInstrument, VK_MULTIPLY, ModCtrl, kKeyEventDown | kKeyEventRepeat, kCtxAllContexts, MPT_V("1.31")}, @@ -1390,6 +1392,7 @@ {2098, kcGotoVolumeColumn, _T("Go to volume effect column")}, {2099, kcGotoCommandColumn, _T("Go to effect command column")}, {2100, kcGotoParamColumn, _T("Go to effect parameter column")}, + {2101, kcContextMenu, _T("Open Context Menu")}, }; // clang-format on @@ -2387,10 +2390,10 @@ if(auto conflictCmd = IsConflicting(kc, kb.cmd, false); conflictCmd.first != kcNull) { - // Allow cross-context conflicts in case the newly added shortcut is in a more specific context + // Allow cross-context conflicts in case the newly added shortcut is in a more generic context // - unless the conflicting shortcut is the reserved dummy shortcut (which was used to prevent // default shortcuts from being added back before default key binding versioning was added). - if(conflictCmd.first == kcDummyShortcut || !m_isParentContext[conflictCmd.second.Context()][kb.ctx]) + if(conflictCmd.first == kcDummyShortcut || !m_isParentContext[kb.ctx][conflictCmd.second.Context()]) continue; } Modified: trunk/OpenMPT/mptrack/CommandSet.h ============================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h Thu Sep 19 15:05:51 2024 (r21623) +++ trunk/OpenMPT/mptrack/CommandSet.h Thu Sep 19 15:30:32 2024 (r21624) @@ -161,7 +161,8 @@ kcEndView = kcHelp, kcStartMisc, - kcPrevInstrument = kcStartMisc, + kcContextMenu = kcStartMisc, + kcPrevInstrument, kcNextInstrument, kcPrevOctave, kcNextOctave, Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp ============================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp Thu Sep 19 15:05:51 2024 (r21623) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp Thu Sep 19 15:30:32 2024 (r21624) @@ -71,55 +71,42 @@ BOOL CNoteMapWnd::PreTranslateMessage(MSG *pMsg) { - if(!pMsg) - return TRUE; - uint32 wParam = static_cast<uint32>(pMsg->wParam); - - { - //We handle keypresses before Windows has a chance to handle them (for alt etc..) - if ((pMsg->message == WM_SYSKEYUP) || (pMsg->message == WM_KEYUP) || - (pMsg->message == WM_SYSKEYDOWN) || (pMsg->message == WM_KEYDOWN)) - { - CInputHandler *ih = CMainFrame::GetInputHandler(); - const auto event = ih->Translate(*pMsg); - - if (ih->KeyEvent(kCtxInsNoteMap, event) != kcNull) - return true; // Mapped to a command, no need to pass message on. - - // a bit of a hack... - if (ih->KeyEvent(kCtxCtrlInstruments, event) != kcNull) - return true; // Mapped to a command, no need to pass message on. - } + //We handle keypresses before Windows has a chance to handle them (for alt etc..) + if ((pMsg->message == WM_SYSKEYUP) || (pMsg->message == WM_KEYUP) || + (pMsg->message == WM_SYSKEYDOWN) || (pMsg->message == WM_KEYDOWN)) + { + CInputHandler *ih = CMainFrame::GetInputHandler(); + const auto event = ih->Translate(*pMsg); + + if (ih->KeyEvent(kCtxInsNoteMap, event, this) != kcNull) + return TRUE; // Mapped to a command, no need to pass message on. + + // a bit of a hack... + if (ih->KeyEvent(kCtxCtrlInstruments, event, this) != kcNull) + return TRUE; // Mapped to a command, no need to pass message on. + + // For context menu shortcut + if(ih->KeyEvent(kCtxAllContexts, event, this) != kcNull) + return TRUE; // Mapped to a command, no need to pass message on. } //The key was not handled by a command, but it might still be useful - if (pMsg->message == WM_CHAR) //key is a character + uint32 wParam = static_cast<uint32>(pMsg->wParam); + if(pMsg->message == WM_CHAR && CInputHandler::GetKeyEventType(*pMsg) == kKeyEventDown) // Key is a character { - if(CInputHandler::GetKeyEventType(*pMsg) == kKeyEventDown) - if(HandleChar(wParam)) - return true; - } - else if (pMsg->message == WM_KEYDOWN) //key is not a character + if(HandleChar(wParam)) + return TRUE; + } else if(pMsg->message == WM_KEYDOWN) // Key is not a character { if(HandleNav(wParam)) - return true; - - // Handle Application (menu) key - if(wParam == VK_APPS) - { - CRect clientRect; - GetClientRect(clientRect); - clientRect.bottom = clientRect.top + mpt::align_up(clientRect.Height(), m_cyFont); - OnRButtonDown(0, clientRect.CenterPoint()); - } - } - else if (pMsg->message == WM_KEYUP) //stop notes on key release + return TRUE; + } else if(pMsg->message == WM_KEYUP) // Stop notes on key release { - if (((pMsg->wParam >= '0') && (pMsg->wParam <= '9')) || (pMsg->wParam == ' ') || + if(((pMsg->wParam >= '0') && (pMsg->wParam <= '9')) || (pMsg->wParam == ' ') || ((pMsg->wParam >= VK_NUMPAD0) && (pMsg->wParam <= VK_NUMPAD9))) { StopNote(); - return true; + return TRUE; } } @@ -272,7 +259,6 @@ { CStatic::OnSetFocus(pOldWnd); Invalidate(FALSE); - CMainFrame::GetMainFrame()->m_pNoteMapHasFocus = this; m_undo = true; } @@ -281,7 +267,6 @@ { CStatic::OnKillFocus(pNewWnd); Invalidate(FALSE); - CMainFrame::GetMainFrame()->m_pNoteMapHasFocus = nullptr; } @@ -615,6 +600,14 @@ switch(wParam) { + case kcContextMenu: + { + CRect clientRect; + GetClientRect(clientRect); + clientRect.bottom = clientRect.top + mpt::align_up(clientRect.Height(), m_cyFont); + OnRButtonDown(0, clientRect.CenterPoint()); + } + return wParam; case kcInsNoteMapTransposeDown: MapTranspose(-1); return wParam; case kcInsNoteMapTransposeUp: MapTranspose(1); return wParam; case kcInsNoteMapTransposeOctDown: MapTranspose(-12); return wParam; Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp ============================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp Thu Sep 19 15:05:51 2024 (r21623) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp Thu Sep 19 15:30:32 2024 (r21624) @@ -446,26 +446,17 @@ CInputHandler *ih = CMainFrame::GetInputHandler(); const auto event = ih->Translate(*pMsg); - if(ih->KeyEvent(kCtxCtrlOrderlist, event) != kcNull) + if(ih->KeyEvent(kCtxCtrlOrderlist, event, this) != kcNull) return TRUE; // Mapped to a command, no need to pass message on. //HACK: masquerade as kCtxViewPatternsNote context until we implement appropriate // command propagation to kCtxCtrlOrderlist context. - if(ih->KeyEvent(kCtxViewPatternsNote, event) != kcNull) + if(ih->KeyEvent(kCtxViewPatternsNote, event, this) != kcNull) return TRUE; // Mapped to a command, no need to pass message on. - // Handle Application (menu) key - if(pMsg->message == WM_KEYDOWN && event.key == VK_APPS) - { - const auto selection = GetCurSel(); - auto pt = (GetRectFromOrder(selection.firstOrd) | GetRectFromOrder(selection.lastOrd)).CenterPoint(); - CRect clientRect; - GetClientRect(clientRect); - if(!clientRect.PtInRect(pt)) - pt = clientRect.CenterPoint(); - OnRButtonDown(0, pt); - } + if(ih->KeyEvent(kCtxAllContexts, event, this) != kcNull) + return TRUE; // Mapped to a command, no need to pass message on. } return CWnd::PreTranslateMessage(pMsg); @@ -474,9 +465,21 @@ LRESULT COrderList::OnCustomKeyMsg(WPARAM wParam, LPARAM lParam) { - bool isPlaying = IsPlaying(); + const bool isPlaying = IsPlaying(); switch(wParam) { + case kcContextMenu: + { + const auto selection = GetCurSel(); + auto pt = (GetRectFromOrder(selection.firstOrd) | GetRectFromOrder(selection.lastOrd)).CenterPoint(); + CRect clientRect; + GetClientRect(clientRect); + if(!clientRect.PtInRect(pt)) + pt = clientRect.CenterPoint(); + OnRButtonDown(0, pt); + } + return wParam; + case kcEditCopy: OnEditCopy(); return wParam; case kcEditCut: @@ -888,7 +891,6 @@ CWnd::OnSetFocus(pWnd); InvalidateSelection(); UpdateInfoText(); - CMainFrame::GetMainFrame()->m_pOrderlistHasFocus = this; } @@ -896,7 +898,6 @@ { CWnd::OnKillFocus(pWnd); InvalidateSelection(); - CMainFrame::GetMainFrame()->m_pOrderlistHasFocus = nullptr; } Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp ============================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp Thu Sep 19 15:05:51 2024 (r21623) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp Thu Sep 19 15:30:32 2024 (r21624) @@ -1900,11 +1900,8 @@ : CProgressDialog{&parent} , m_updateInterval{std::max(uint32(15), TrackerSettings::Instance().GUIUpdateInterval.Get())} { - const auto updateFunc = std::bind(&DoPitchShiftTimeStretch::UpdateProgress, this, std::placeholders::_1, std::placeholders::_2); - const auto prepareUndo = [&parent]() - { - return parent.PrepareUndo("Pitch Shift / Time Stretch", sundo_replace); - }; + const auto updateFunc = [this](SmpLength current, SmpLength maximum) { return UpdateProgress(current, maximum); }; + const auto prepareUndo = [&parent]() { return parent.PrepareUndo("Pitch Shift / Time Stretch", sundo_replace); }; CSoundFile &sndFile = modDoc.GetSoundFile(); if(loFi) Modified: trunk/OpenMPT/mptrack/MainFrm.cpp ============================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp Thu Sep 19 15:05:51 2024 (r21623) +++ trunk/OpenMPT/mptrack/MainFrm.cpp Thu Sep 19 15:30:32 2024 (r21624) @@ -2520,7 +2520,6 @@ case kcPrevDocument: MDIPrev(); break; case kcFileCloseAll: theApp.OnFileCloseAll(); break; - //D'oh!! moddoc isn't a CWnd so we have to handle its messages and pass them on. case kcFileSaveAs: @@ -2581,17 +2580,8 @@ m_wndTree.SetFocus(); break; - //if handled neither by MainFrame nor by ModDoc... default: - //If the treeview has focus, post command to the tree view - if (m_bModTreeHasFocus) - return m_wndTree.SendMessageToModTree(WM_MOD_KEYCOMMAND, wParam, lParam); - if (m_pNoteMapHasFocus) - return m_pNoteMapHasFocus->SendMessage(WM_MOD_KEYCOMMAND, wParam, lParam); - if (m_pOrderlistHasFocus) - return m_pOrderlistHasFocus->SendMessage(WM_MOD_KEYCOMMAND, wParam, lParam); - - //Else send it to the active view + // If handled neither by MainFrame nor by ModDoc, send it to the active view CMDIChildWnd *pMDIActive = MDIGetActive(); CWnd *wnd = nullptr; if(pMDIActive) Modified: trunk/OpenMPT/mptrack/Mainbar.cpp ============================================================================== --- trunk/OpenMPT/mptrack/Mainbar.cpp Thu Sep 19 15:05:51 2024 (r21623) +++ trunk/OpenMPT/mptrack/Mainbar.cpp Thu Sep 19 15:30:32 2024 (r21624) @@ -1291,22 +1291,6 @@ } -HWND CModTreeBar::GetModTreeHWND() -{ - return m_pModTree->m_hWnd; -} - - -LRESULT CModTreeBar::SendMessageToModTree(UINT cmdID, WPARAM wParam, LPARAM lParam) -{ - if(::GetFocus() == m_pModTree->m_hWnd) - return m_pModTree->SendMessage(cmdID, wParam, lParam); - if(::GetFocus() == m_pModTreeData->m_hWnd) - return m_pModTreeData->SendMessage(cmdID, wParam, lParam); - return 0; -} - - bool CModTreeBar::SetTreeSoundfile(FileReader &file) { return m_pModTree->SetSoundFile(file); Modified: trunk/OpenMPT/mptrack/Mainbar.h ============================================================================== --- trunk/OpenMPT/mptrack/Mainbar.h Thu Sep 19 15:05:51 2024 (r21623) +++ trunk/OpenMPT/mptrack/Mainbar.h Thu Sep 19 15:30:32 2024 (r21624) @@ -173,8 +173,6 @@ void OnDocumentClosed(CModDoc *pModDoc); void OnUpdate(CModDoc *pModDoc, UpdateHint hint, CObject *pHint = nullptr); void UpdatePlayPos(CModDoc *pModDoc, Notification *pNotify); - HWND GetModTreeHWND(); //rewbs.customKeys - LRESULT SendMessageToModTree(UINT cmdID, WPARAM wParam, LPARAM lParam); bool SetTreeSoundfile(FileReader &file); void StartTreeFilter(CModTree &source); Modified: trunk/OpenMPT/mptrack/Mainfrm.h ============================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h Thu Sep 19 15:05:51 2024 (r21623) +++ trunk/OpenMPT/mptrack/Mainfrm.h Thu Sep 19 15:30:32 2024 (r21624) @@ -208,8 +208,6 @@ CAutoSaver m_AutoSaver; public: - CWnd *m_pNoteMapHasFocus = nullptr; - CWnd *m_pOrderlistHasFocus = nullptr; bool m_bModTreeHasFocus = false; public: Modified: trunk/OpenMPT/mptrack/View_ins.cpp ============================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp Thu Sep 19 15:05:51 2024 (r21623) +++ trunk/OpenMPT/mptrack/View_ins.cpp Thu Sep 19 15:30:32 2024 (r21624) @@ -2260,18 +2260,6 @@ const auto event = ih->Translate(*pMsg); if(ih->KeyEvent(kCtxViewInstruments, event) != kcNull) return TRUE; // Mapped to a command, no need to pass message on. - - // Handle Application (menu) key - if(pMsg->message == WM_KEYDOWN && event.key == VK_APPS) - { - CPoint pt(0, 0); - if(m_nDragItem > 0) - { - uint32 point = DragItemToEnvPoint(); - pt.SetPoint(PointToScreen(point), ValueToScreen(EnvGetValue(point))); - } - OnRButtonDown(0, pt); - } } } @@ -2288,6 +2276,17 @@ switch(wParam) { + case kcContextMenu: + { + CPoint pt(0, 0); + if(m_nDragItem > 0) + { + uint32 point = DragItemToEnvPoint(); + pt.SetPoint(PointToScreen(point), ValueToScreen(EnvGetValue(point))); + } + OnRButtonDown(0, pt); + } + return wParam; case kcPrevInstrument: OnPrevInstrument(); return wParam; case kcNextInstrument: OnNextInstrument(); return wParam; case kcEditCopy: OnEditCopy(); return wParam; Modified: trunk/OpenMPT/mptrack/View_pat.cpp ============================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp Thu Sep 19 15:05:51 2024 (r21623) +++ trunk/OpenMPT/mptrack/View_pat.cpp Thu Sep 19 15:30:32 2024 (r21624) @@ -710,12 +710,6 @@ } } //end HACK. - - // Handle Application (menu) key - if(pMsg->message == WM_KEYDOWN && event.key == VK_APPS) - { - OnRButtonDown(0, GetPointFromPosition(m_Cursor)); - } } else if(pMsg->message == WM_MBUTTONDOWN) { // Open quick channel properties dialog if we're middle-clicking a channel header. @@ -4334,6 +4328,8 @@ switch(wParam) { + case kcContextMenu: OnRButtonDown(0, GetPointFromPosition(m_Cursor)); return wParam; + case kcPrevInstrument: OnPrevInstrument(); return wParam; case kcNextInstrument: OnNextInstrument(); return wParam; case kcPrevOrder: GotoPreviousOrder(); return wParam; Modified: trunk/OpenMPT/mptrack/View_smp.cpp ============================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp Thu Sep 19 15:05:51 2024 (r21623) +++ trunk/OpenMPT/mptrack/View_smp.cpp Thu Sep 19 15:30:32 2024 (r21624) @@ -3656,13 +3656,6 @@ const auto event = ih->Translate(*pMsg); if (ih->KeyEvent(kCtxViewSamples, event) != kcNull) return true; // Mapped to a command, no need to pass message on. - - // Handle Application (menu) key - if(pMsg->message == WM_KEYDOWN && event.key == VK_APPS) - { - int x = Util::ScalePixels(32, m_hWnd); - OnRButtonDown(0, CPoint(x, x)); - } } } @@ -3679,6 +3672,8 @@ switch(wParam) { + case kcContextMenu: OnRButtonDown(0, CPoint(0, TimelineHeight(m_hWnd))); return wParam; + case kcSampleTrim: TrimSample(false); return wParam; case kcSampleTrimToLoopEnd: TrimSample(true); return wParam; case kcSampleZoomUp: OnZoomUp(); return wParam; Modified: trunk/OpenMPT/mptrack/View_tre.cpp ============================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp Thu Sep 19 15:05:51 2024 (r21623) +++ trunk/OpenMPT/mptrack/View_tre.cpp Thu Sep 19 15:30:32 2024 (r21624) @@ -276,17 +276,6 @@ { switch(pMsg->wParam) { - case VK_APPS: - // Handle Application (menu) key - if(HTREEITEM item = GetSelectedItem()) - { - CRect rect; - GetItemRect(item, &rect, FALSE); - ClientToScreen(rect); - OnItemRightClick(item, rect.TopLeft() + CPoint{rect.Height() / 2, rect.Height() / 2}); - } - return TRUE; - case VK_ESCAPE: GetParent()->PostMessage(WM_COMMAND, ID_CLOSE_LIBRARY_FILTER); break; @@ -315,7 +304,12 @@ (pMsg->message == WM_SYSKEYDOWN) || (pMsg->message == WM_KEYDOWN)) { CInputHandler *ih = CMainFrame::GetInputHandler(); - if(ih->KeyEvent(kCtxViewTree, ih->Translate(*pMsg)) != kcNull) + const auto event = ih->Translate(*pMsg); + if(ih->KeyEvent(kCtxViewTree, event, this) != kcNull) + return TRUE; // Mapped to a command, no need to pass message on. + + // For context menu shortcut + if(ih->KeyEvent(kCtxAllContexts, event, this) != kcNull) return TRUE; // Mapped to a command, no need to pass message on. } return CTreeCtrl::PreTranslateMessage(pMsg); @@ -525,31 +519,31 @@ HTREEITEM parent = GetChildItem(m_hMidiLib); for(UINT iMidi = 0; iMidi < 128; iMidi++) { - DWORD dwImage = IMAGE_INSTRMUTE; + int image = IMAGE_INSTRMUTE; s = mpt::cfmt::val(iMidi) + _T(": ") + mpt::ToCString(mpt::Charset::ASCII, szMidiProgramNames[iMidi]); const LPARAM param = (MODITEM_MIDIINSTRUMENT << MIDILIB_SHIFT) | iMidi; if(!midiLib[iMidi].empty()) { s += _T(": ") + midiLib[iMidi].GetFilename().ToCString(); - dwImage = IMAGE_INSTRUMENTS; + image = IMAGE_INSTRUMENTS; } if(!m_tiMidi[iMidi]) { m_tiMidi[iMidi] = InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM, - s, dwImage, dwImage, 0, 0, param, parent, TVI_LAST); + s, image, image, 0, 0, param, parent, TVI_LAST); } else { tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; tvi.hItem = m_tiMidi[iMidi]; tvi.pszText = stmp.GetBuffer(s.GetLength() + 1); tvi.cchTextMax = stmp.GetAllocLength(); - tvi.iImage = tvi.iSelectedImage = dwImage; + tvi.iImage = tvi.iSelectedImage = image; GetItem(&tvi); s.ReleaseBuffer(); - if(s != stmp || tvi.iImage != (int)dwImage) + if(s != stmp || tvi.iImage != image) { SetItem(m_tiMidi[iMidi], TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM, - s, dwImage, dwImage, 0, 0, param); + s, image, image, 0, 0, param); } } if((iMidi % 8u) == 7u) @@ -4191,6 +4185,17 @@ switch(wParam) { + case kcContextMenu: + if(HTREEITEM item = GetSelectedItem()) + { + CRect rect; + GetItemRect(item, &rect, FALSE); + ClientToScreen(rect); + OnItemRightClick(item, rect.TopLeft() + CPoint{ rect.Height() / 2, rect.Height() / 2 }); + return wParam; + } + break; + case kcTreeViewStopPreview: note = NOTE_NOTECUT; break; |