| 629 | } |
| 630 | |
| 631 | void 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 | |
| 667 | void CInstrumentEditorDPCM::OnNMDblclkTable(NMHDR *pNMHDR, LRESULT *pResult) |
| 668 | { |
nothing calls this directly
no test coverage detected