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

Method BuildMenuTree

Source/InstrumentFileTree.cpp:44–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44bool CInstrumentFileTree::BuildMenuTree(const CStringW &instrumentPath) // // //
45{
46 CWaitCursor wait;
47
48 TRACE(L"Clearing instrument file tree...\n"); // // //
49
50 m_fileList.clear();
51 m_menuArray.clear();
52 m_iTotalMenusAdded = 0;
53
54 TRACE(L"Building instrument file tree...\n");
55
56 m_RootMenu.CreatePopupMenu();
57 m_RootMenu.AppendMenuW(MFT_STRING, MENU_BASE + 0, L"Open file...");
58 m_RootMenu.AppendMenuW(MFT_STRING, MENU_BASE + 1, L"Select directory...");
59 m_RootMenu.AppendMenuW(MFT_SEPARATOR);
60 m_RootMenu.SetDefaultItem(0, TRUE);
61
62 if (instrumentPath.GetLength() == 0) {
63 m_bShouldRebuild = true;
64 m_RootMenu.AppendMenuW(MFT_STRING | MFS_DISABLED, MENU_BASE + 2, L"(select a directory)");
65 }
66 else {
67 m_iFileIndex = 2;
68
69 if (!ScanDirectory(instrumentPath, m_RootMenu, 0)) { // // //
70 // No files found
71 m_RootMenu.AppendMenuW(MFT_STRING | MFS_DISABLED, MENU_BASE + 2, L"(no files found)");
72 m_bShouldRebuild = true;
73 }
74 else {
75 m_fileList.shrink_to_fit(); // // //
76 m_menuArray.shrink_to_fit();
77
78 m_iTimeout = GetTickCount() + CACHE_TIMEOUT;
79 m_bShouldRebuild = false;
80 }
81 }
82
83 TRACE(L"Done\n");
84
85 return true;
86}
87
88bool CInstrumentFileTree::ScanDirectory(const CStringW &path, CMenu &Menu, int level) { // // //
89 CFileFind fileFinder;

Callers 1

OnLoadInstrumentMenuMethod · 0.80

Calls 2

clearMethod · 0.45
GetLengthMethod · 0.45

Tested by

no test coverage detected