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

Method OnLoadInstrumentMenu

Source/MainFrm.cpp:2606–2636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2604}
2605
2606void 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
2638void CMainFrame::SelectInstrumentFolder()
2639{

Callers

nothing calls this directly

Calls 8

ShouldRebuildMethod · 0.80
BuildMenuTreeMethod · 0.80
GetPathMethod · 0.80
GetModuleMethod · 0.80
GetFirstUnusedMethod · 0.80
GetFileMethod · 0.80
GetSettingsMethod · 0.45
GetInstrumentManagerMethod · 0.45

Tested by

no test coverage detected