MCPcopy Create free account
hub / github.com/assimp/assimp / LoadHistory

Function LoadHistory

tools/assimp_view/MessageProc.cpp:742–774  ·  view source on GitHub ↗

------------------------------------------------------------------------------- Recover the file history -------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

740// Recover the file history
741//-------------------------------------------------------------------------------
742void LoadHistory() {
743 g_aPreviousFiles.resize(AI_VIEW_NUM_RECENT_FILES);
744
745 char szFileName[MAX_PATH];
746
747 for (unsigned int i = 0; i < AI_VIEW_NUM_RECENT_FILES;++i) {
748 char szName[66];
749 sprintf(szName,"Recent%i",i+1);
750
751 DWORD dwTemp = MAX_PATH;
752
753 szFileName[0] ='\0';
754 if(ERROR_SUCCESS == RegQueryValueEx(g_hRegistry,szName,nullptr,nullptr,
755 (BYTE*)szFileName,&dwTemp)) {
756 g_aPreviousFiles[i] = std::string(szFileName);
757 }
758 }
759
760 // add sub items for all recent files
761 g_hHistoryMenu = CreateMenu();
762 for (int i = AI_VIEW_NUM_RECENT_FILES-1; i >= 0;--i) {
763 const char* szText = g_aPreviousFiles[i].c_str();
764 UINT iFlags = 0;
765 if ('\0' == *szText) {
766 szText = "<empty>";
767 iFlags = MF_GRAYED | MF_DISABLED;
768 }
769 AppendMenu(g_hHistoryMenu,MF_STRING | iFlags,AI_VIEW_RECENT_FILE_ID(i),szText);
770 }
771
772 ModifyMenu(GetMenu(g_hDlg),ID_VIEWER_RECENTFILES,MF_BYCOMMAND | MF_POPUP,
773 (UINT_PTR)g_hHistoryMenu,"Recent files");
774}
775
776//-------------------------------------------------------------------------------
777// Clear the file history

Callers 1

MessageProcFunction · 0.85

Calls 1

resizeMethod · 0.45

Tested by

no test coverage detected