MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / OnNMRClickTable

Method OnNMRClickTable

Source/InstrumentEditorDPCM.cpp:631–665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

629}
630
631void CInstrumentEditorDPCM::OnNMRClickTable(NMHDR *pNMHDR, LRESULT *pResult)
632{
633 // Create a popup menu for key list with samples
634 m_iSelectedNote = m_cTableListCtrl.GetSelectionMark(); // // //
635
636 CPoint point;
637 CMenu PopupMenu;
638 GetCursorPos(&point);
639 PopupMenu.CreatePopupMenu();
640 PopupMenu.AppendMenuW(MFT_STRING, (int)CInstrument2A03::NO_DPCM + 2, NO_SAMPLE_STR); // // //
641
642 // Fill menu
643 for (int i = 0; i < MAX_DSAMPLES; ++i)
644 if (auto pDSample = GetDSampleManager()->GetDSample(i)) // // //
645 PopupMenu.AppendMenuW(MFT_STRING, i + 2, conv::to_wide(pDSample->name()).data());
646
647 UINT Result = PopupMenu.TrackPopupMenu(TPM_RIGHTBUTTON | TPM_RETURNCMD, point.x, point.y, this);
648
649 if (Result - 2 == CInstrument2A03::NO_DPCM) {
650 // Remove sample
651 m_pInstrument->SetSampleIndex(m_iSelectedNote, CInstrument2A03::NO_DPCM);
652 GetDocument()->ModifyIrreversible(); // // //
653 UpdateCurrentKey();
654 }
655 else if (Result) {
656 // Add sample
657 int Pitch = m_cComboSamplePitch.GetCurSel();
658 m_pInstrument->SetSampleIndex(m_iSelectedNote, Result - 2);
659 m_pInstrument->SetSamplePitch(m_iSelectedNote, Pitch);
660 GetDocument()->ModifyIrreversible(); // // //
661 UpdateCurrentKey();
662 }
663
664 *pResult = 0;
665}
666
667void CInstrumentEditorDPCM::OnNMDblclkTable(NMHDR *pNMHDR, LRESULT *pResult)
668{

Callers

nothing calls this directly

Calls 7

to_wideFunction · 0.85
SetSampleIndexMethod · 0.80
ModifyIrreversibleMethod · 0.80
SetSamplePitchMethod · 0.80
GetDSampleMethod · 0.45
dataMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected