MCPcopy Create free account
hub / github.com/CobaltFusion/DebugViewPP / OnContextMenu

Method OnContextMenu

DebugView++/LogView.cpp:360–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358}
359
360void CLogView::OnContextMenu(HWND /*hWnd*/, CPoint pt)
361{
362 if (pt == CPoint(-1, -1))
363 {
364 RECT rect = GetItemRect(GetNextItem(-1, LVNI_ALL | LVNI_FOCUSED), LVIR_LABEL);
365 pt = CPoint(rect.left, rect.bottom - 1);
366 }
367 else
368 {
369 ScreenToClient(&pt);
370 }
371
372 HDHITTESTINFO hdrInfo;
373 hdrInfo.flags = 0;
374 hdrInfo.pt = pt;
375 GetHeader().HitTest(&hdrInfo);
376
377 LVHITTESTINFO info;
378 info.flags = 0;
379 info.pt = pt;
380 SubItemHitTest(&info);
381
382 int menuId = 0;
383 if ((hdrInfo.flags & HHT_ONHEADER) != 0)
384 menuId = IDR_HEADER_CONTEXTMENU;
385 else if ((info.flags & LVHT_ONITEM) != 0)
386 {
387 switch (SubItemToColumn(info.iSubItem))
388 {
389 case Column::Process:
390 menuId = IDR_PROCESS_CONTEXTMENU;
391 break;
392 case Column::Message:
393 menuId = TextHighlightHitTest(info.iItem, pt) == 1 ? IDR_HIGHLIGHT_CONTEXTMENU : IDR_VIEW_CONTEXTMENU;
394 break;
395 default:
396 menuId = IDR_VIEW_CONTEXTMENU;
397 break;
398 }
399 }
400 else
401 return;
402
403 CMenu menuContext;
404 menuContext.LoadMenu(menuId);
405 CMenuHandle menuPopup(menuContext.GetSubMenu(0));
406 ClientToScreen(&pt);
407 menuPopup.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, m_mainFrame);
408}
409
410bool iswordchar(int c)
411{

Callers

nothing calls this directly

Calls 1

GetItemRectFunction · 0.85

Tested by

no test coverage detected