| 2570 | } |
| 2571 | |
| 2572 | void CMainFrame::OnNewInstrumentMenu(NMHDR* pNotifyStruct, LRESULT* result) |
| 2573 | { |
| 2574 | CRect rect; |
| 2575 | ::GetWindowRect(pNotifyStruct->hwndFrom, &rect); |
| 2576 | |
| 2577 | CMenu menu; |
| 2578 | menu.CreatePopupMenu(); |
| 2579 | |
| 2580 | const CFamiTrackerDoc &Doc = GetDoc(); |
| 2581 | |
| 2582 | CSoundChipSet Chip = Doc.GetModule()->GetSoundChipSet(); // // // |
| 2583 | sound_chip_t SelectedChip = GetTrackerView()->GetSelectedChannelID().Chip; // // // where the cursor is located |
| 2584 | |
| 2585 | auto *pSCS = FTEnv.GetSoundChipService(); |
| 2586 | pSCS->ForeachType([&] (sound_chip_t c) { |
| 2587 | if (Chip.ContainsChip(c)) |
| 2588 | menu.AppendMenuW(MFT_STRING, value_cast(c) + 1, (L"New " + conv::to_wide(pSCS->GetChipShortName(c)) + L" instrument").data()); |
| 2589 | }); |
| 2590 | |
| 2591 | if (SelectedChip != sound_chip_t::none) |
| 2592 | menu.SetDefaultItem(value_cast(SelectedChip) + 1); |
| 2593 | |
| 2594 | if (UINT retValue = menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_NONOTIFY, rect.left, rect.bottom, this)) // // // |
| 2595 | switch ((sound_chip_t)(retValue - 1u)) { |
| 2596 | case sound_chip_t::APU: OnAddInstrument2A03(); break; |
| 2597 | case sound_chip_t::VRC6: OnAddInstrumentVRC6(); break; |
| 2598 | case sound_chip_t::VRC7: OnAddInstrumentVRC7(); break; |
| 2599 | case sound_chip_t::FDS: OnAddInstrumentFDS(); break; |
| 2600 | case sound_chip_t::MMC5: OnAddInstrumentMMC5(); break; |
| 2601 | case sound_chip_t::N163: OnAddInstrumentN163(); break; |
| 2602 | case sound_chip_t::S5B: OnAddInstrumentS5B(); break; |
| 2603 | } |
| 2604 | } |
| 2605 | |
| 2606 | void CMainFrame::OnLoadInstrumentMenu(NMHDR * pNotifyStruct, LRESULT * result) |
| 2607 | { |
nothing calls this directly
no test coverage detected