| 2604 | } |
| 2605 | |
| 2606 | void CMainFrame::OnLoadInstrumentMenu(NMHDR * pNotifyStruct, LRESULT * result) |
| 2607 | { |
| 2608 | CRect rect; |
| 2609 | ::GetWindowRect(pNotifyStruct->hwndFrom, &rect); |
| 2610 | |
| 2611 | // Build menu tree |
| 2612 | if (!m_pInstrumentFileTree) |
| 2613 | m_pInstrumentFileTree = std::make_unique<CInstrumentFileTree>(); // // // |
| 2614 | if (m_pInstrumentFileTree->ShouldRebuild()) |
| 2615 | m_pInstrumentFileTree->BuildMenuTree(FTEnv.GetSettings()->GetPath(PATH_INST).c_str()); |
| 2616 | |
| 2617 | UINT retValue = m_pInstrumentFileTree->GetMenu().TrackPopupMenu( |
| 2618 | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_NONOTIFY, rect.left, rect.bottom, this); |
| 2619 | switch (retValue) { |
| 2620 | case CInstrumentFileTree::MENU_BASE: // Open file |
| 2621 | OnLoadInstrument(); |
| 2622 | break; |
| 2623 | case CInstrumentFileTree::MENU_BASE + 1: // Select dir |
| 2624 | SelectInstrumentFolder(); |
| 2625 | break; |
| 2626 | default: |
| 2627 | if (retValue >= CInstrumentFileTree::MENU_BASE + 2) { // A file |
| 2628 | auto &Im = *GetDoc().GetModule()->GetInstrumentManager(); // // // |
| 2629 | int Index = Im.GetFirstUnused(); |
| 2630 | if (!LoadInstrument(Index, m_pInstrumentFileTree->GetFile(retValue))) |
| 2631 | return; |
| 2632 | SelectInstrument(Index); |
| 2633 | UpdateInstrumentList(); |
| 2634 | } |
| 2635 | } |
| 2636 | } |
| 2637 | |
| 2638 | void CMainFrame::SelectInstrumentFolder() |
| 2639 | { |
nothing calls this directly
no test coverage detected