From: <sag...@us...> - 2014-03-23 15:12:37
|
Revision: 3939 http://sourceforge.net/p/modplug/code/3939 Author: saga-games Date: 2014-03-23 15:12:27 +0000 (Sun, 23 Mar 2014) Log Message: ----------- [Imp] When rescanning plugins on startup, show a progress dialog if it's taking too long. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2014-03-23 15:02:20 UTC (rev 3938) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2014-03-23 15:12:27 UTC (rev 3939) @@ -2004,6 +2004,10 @@ std::wstring nonFoundPlugs; const mpt::PathString failedPlugin = theApp.GetSettings().Read<mpt::PathString>("VST Plugins", "FailedPlugin", MPT_PATHSTRING("")); + CDialog pluginScanDlg; + DWORD scanStart = GetTickCount(); + bool dialogShown = false; + m_pPluginManager->reserve(numPlugins); for(size_t plug = 0; plug < numPlugins; plug++) { @@ -2024,6 +2028,26 @@ } m_pPluginManager->AddPlugin(plugPath, true, true, &nonFoundPlugs); } + + if(!dialogShown && GetTickCount() >= scanStart + 1000) + { + // If this is taking too long, show the user what he's waiting for. + dialogShown = true; + pluginScanDlg.Create(IDD_SCANPLUGINS, gpSplashScreen); + pluginScanDlg.ShowWindow(SW_SHOW); + pluginScanDlg.CenterWindow(gpSplashScreen); + } else if(dialogShown) + { + CWnd *text = pluginScanDlg.GetDlgItem(IDC_SCANTEXT); + std::wstring scanStr = mpt::String::PrintW(L"Scanning Plugin %1 / %2...\n%3", plug, numPlugins, plugPath); + SetWindowTextW(text->m_hWnd, scanStr.c_str()); + MSG msg; + while(::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + } } if(!nonFoundPlugs.empty()) { Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2014-03-23 15:02:20 UTC (rev 3938) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2014-03-23 15:12:27 UTC (rev 3939) @@ -587,6 +587,11 @@ VSTPluginLib *plugLib = nullptr; bool update = false; + CDialog pluginScanDlg; + pluginScanDlg.Create(IDD_SCANPLUGINS, this); + pluginScanDlg.CenterWindow(this); + pluginScanDlg.ShowWindow(SW_SHOW); + std::vector<mpt::PathString> paths(1, dlg.GetDirectory()); int files = 0; while(!paths.empty()) @@ -613,7 +618,16 @@ continue; } else if(!mpt::PathString::CompareNoCase(fileName.GetFileExt(), MPT_PATHSTRING(".dll"))) { - CMainFrame::GetMainFrame()->SetHelpText(mpt::ToLocale(wfd.cFileName).c_str()); + CWnd *text = pluginScanDlg.GetDlgItem(IDC_SCANTEXT); + std::wstring scanStr = std::wstring(L"Scanning Plugin...\n") + wfd.cFileName; + SetWindowTextW(text->m_hWnd, scanStr.c_str()); + MSG msg; + while(::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + VSTPluginLib *lib = pManager->AddPlugin(fileName, false); if(lib) { Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-03-23 15:02:20 UTC (rev 3938) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-03-23 15:12:27 UTC (rev 3939) @@ -300,7 +300,16 @@ LTEXT "Warning:\nChanging advanced settings might cause stability problems.\nYou should only continue if you know what you are doing.",IDC_STATIC,6,6,258,24 END +IDD_SCANPLUGINS DIALOGEX 0, 0, 316, 34 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_APPWINDOW +CAPTION "Updating Plugin Cache..." +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + CTEXT "",IDC_SCANTEXT,6,7,306,20,SS_NOPREFIX +END + ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO @@ -428,6 +437,14 @@ TOPMARGIN, 7 BOTTOMMARGIN, 267 END + + IDD_SCANPLUGINS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 309 + TOPMARGIN, 7 + BOTTOMMARGIN, 27 + END END #endif // APSTUDIO_INVOKED Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2014-03-23 15:02:20 UTC (rev 3938) +++ trunk/OpenMPT/mptrack/resource.h 2014-03-23 15:12:27 UTC (rev 3939) @@ -133,6 +133,7 @@ #define IDD_CLIPBOARD 533 #define IDD_OPTIONS_ADVANCED 534 #define IDD_OPTIONS_SAMPLEEDITOR 535 +#define IDD_SCANPLUGINS 536 #define IDC_BUTTON1 1001 #define IDC_BUTTON2 1002 #define IDC_BUTTON3 1003 @@ -960,6 +961,7 @@ #define IDC_COMBO_CHANNEL_FRONTRIGHT 2476 #define IDC_COMBO_CHANNEL_REARLEFT 2477 #define IDC_COMBO_CHANNEL_REARRIGHT 2478 +#define IDC_SCANTEXT 2479 #define ID_FILE_NEWMOD 32771 #define ID_FILE_NEWXM 32772 #define ID_FILE_NEWS3M 32773 @@ -1240,9 +1242,9 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 -#define _APS_NEXT_RESOURCE_VALUE 536 +#define _APS_NEXT_RESOURCE_VALUE 537 #define _APS_NEXT_COMMAND_VALUE 44644 -#define _APS_NEXT_CONTROL_VALUE 2479 +#define _APS_NEXT_CONTROL_VALUE 2480 #define _APS_NEXT_SYMED_VALUE 901 #endif #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |