mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Minor improvement to About dialog (The plugins list is now generated only when Plugins entry is selected, not on initialization. As a result, the About dialog opens considerably faster.).
This commit is contained in:
parent
7b5330896f
commit
054bcd9796
@ -48,7 +48,7 @@ HWND OpenAboutDialog(HWND hwndOwner, HINSTANCE instance)
|
|||||||
if (g_DialogWin == NULL)
|
if (g_DialogWin == NULL)
|
||||||
{
|
{
|
||||||
g_DialogWin = CreateDialog(instance, MAKEINTRESOURCE(IDD_ABOUT_DIALOG), hwndOwner, AboutProc);
|
g_DialogWin = CreateDialog(instance, MAKEINTRESOURCE(IDD_ABOUT_DIALOG), hwndOwner, AboutProc);
|
||||||
|
|
||||||
if (g_DialogWin)
|
if (g_DialogWin)
|
||||||
{
|
{
|
||||||
HICON hIcon = LoadIcon(instance, MAKEINTRESOURCE(IDI_TRAY));
|
HICON hIcon = LoadIcon(instance, MAKEINTRESOURCE(IDI_TRAY));
|
||||||
@ -288,6 +288,11 @@ void UpdateWidgets()
|
|||||||
ListView_SetColumn(widget, 2, &lvc);
|
ListView_SetColumn(widget, 2, &lvc);
|
||||||
|
|
||||||
// Update the list of plugins
|
// Update the list of plugins
|
||||||
|
if (g_Plugins.empty())
|
||||||
|
{
|
||||||
|
ScanPlugins();
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<PLUGIN_INFO>::const_iterator iter = g_Plugins.begin();
|
std::vector<PLUGIN_INFO>::const_iterator iter = g_Plugins.begin();
|
||||||
LVITEM vitem;
|
LVITEM vitem;
|
||||||
vitem.mask = LVIF_TEXT;
|
vitem.mask = LVIF_TEXT;
|
||||||
@ -338,15 +343,13 @@ typedef UINT (*GETPLUGINVERSION)();
|
|||||||
|
|
||||||
void ScanPlugins()
|
void ScanPlugins()
|
||||||
{
|
{
|
||||||
WIN32_FIND_DATA fileData; // Data structure describes the file found
|
WIN32_FIND_DATA fileData; // Data structure describes the file found
|
||||||
HANDLE hSearch; // Search handle returned by FindFirstFile
|
HANDLE hSearch; // Search handle returned by FindFirstFile
|
||||||
|
|
||||||
std::wstring files = Rainmeter->GetPluginPath() + L"*.dll";
|
std::wstring files = Rainmeter->GetPluginPath() + L"*.dll";
|
||||||
|
|
||||||
g_Plugins.clear();
|
// Start searching for .ini files in the given directory.
|
||||||
|
hSearch = FindFirstFile(files.c_str(), &fileData);
|
||||||
// Start searching for .ini files in the given directory.
|
|
||||||
hSearch = FindFirstFile(files.c_str(), &fileData);
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if(hSearch == INVALID_HANDLE_VALUE) break; // No more files found
|
if(hSearch == INVALID_HANDLE_VALUE) break; // No more files found
|
||||||
@ -486,8 +489,6 @@ BOOL OnInitAboutDialog(HWND window)
|
|||||||
lvc.cx = 150;
|
lvc.cx = 150;
|
||||||
lvc.pszText = L"Message";
|
lvc.pszText = L"Message";
|
||||||
ListView_InsertColumn(widget, 2, &lvc);
|
ListView_InsertColumn(widget, 2, &lvc);
|
||||||
|
|
||||||
ScanPlugins();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateWidgets();
|
UpdateWidgets();
|
||||||
@ -498,78 +499,78 @@ BOOL OnInitAboutDialog(HWND window)
|
|||||||
|
|
||||||
INT_PTR CALLBACK AboutProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK AboutProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
return OnInitAboutDialog(hwndDlg);
|
return OnInitAboutDialog(hwndDlg);
|
||||||
|
|
||||||
case WM_WINDOWPOSCHANGING:
|
case WM_WINDOWPOSCHANGING:
|
||||||
|
{
|
||||||
|
WINDOWPOS* pos = (WINDOWPOS*)lParam;
|
||||||
|
|
||||||
|
pos->cx = max(280, pos->cx);
|
||||||
|
pos->cy = max(280, pos->cy);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_SIZE:
|
||||||
|
RepositionControls(hwndDlg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_CLOSE:
|
||||||
|
KillTimer(hwndDlg, LOGTIMER);
|
||||||
|
Rainmeter->SaveSettings();
|
||||||
|
DestroyWindow(hwndDlg);
|
||||||
|
g_DialogWin = NULL;
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
|
case IDC_DISABLE_VERSION_CHECK:
|
||||||
|
if (IsDlgButtonChecked(hwndDlg, IDC_DISABLE_VERSION_CHECK))
|
||||||
{
|
{
|
||||||
WINDOWPOS* pos = (WINDOWPOS*)lParam;
|
Rainmeter->SetDisableVersionCheck(TRUE);
|
||||||
|
}
|
||||||
pos->cx = max(280, pos->cx);
|
else
|
||||||
pos->cy = max(280, pos->cy);
|
{
|
||||||
|
Rainmeter->SetDisableVersionCheck(FALSE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SIZE:
|
case IDOK:
|
||||||
RepositionControls(hwndDlg);
|
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_CLOSE:
|
|
||||||
KillTimer(hwndDlg, LOGTIMER);
|
|
||||||
Rainmeter->SaveSettings();
|
|
||||||
DestroyWindow(hwndDlg);
|
|
||||||
g_DialogWin = NULL;
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case IDC_ABOUT_ENTRIES:
|
||||||
switch (LOWORD(wParam))
|
if (HIWORD(wParam) == LBN_SELCHANGE)
|
||||||
{
|
{
|
||||||
case IDC_DISABLE_VERSION_CHECK:
|
KillTimer(hwndDlg, LOGTIMER);
|
||||||
if (IsDlgButtonChecked(hwndDlg, IDC_DISABLE_VERSION_CHECK))
|
|
||||||
{
|
|
||||||
Rainmeter->SetDisableVersionCheck(TRUE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Rainmeter->SetDisableVersionCheck(FALSE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDOK:
|
HWND widget = GetDlgItem(hwndDlg, IDC_ABOUT_ENTRIES);
|
||||||
SendMessage(hwndDlg, WM_CLOSE, 0, 0);
|
if (widget != NULL)
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
case IDC_ABOUT_ENTRIES:
|
|
||||||
if (HIWORD(wParam) == LBN_SELCHANGE)
|
|
||||||
{
|
{
|
||||||
KillTimer(hwndDlg, LOGTIMER);
|
if (0 == (int)SendMessage(widget, LB_GETCURSEL, 0, 0))
|
||||||
|
|
||||||
HWND widget = GetDlgItem(hwndDlg, IDC_ABOUT_ENTRIES);
|
|
||||||
if (widget != NULL)
|
|
||||||
{
|
{
|
||||||
if (0 == (int)SendMessage(widget, LB_GETCURSEL, 0, 0))
|
SetTimer(g_DialogWin, LOGTIMER, 1000, NULL);
|
||||||
{
|
|
||||||
SetTimer(g_DialogWin, LOGTIMER, 1000, NULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UpdateWidgets();
|
UpdateWidgets();
|
||||||
UpdateAboutStatistics();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_TIMER:
|
|
||||||
if (wParam == LOGTIMER)
|
|
||||||
{
|
|
||||||
UpdateAboutStatistics();
|
UpdateAboutStatistics();
|
||||||
return TRUE;
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_TIMER:
|
||||||
|
if (wParam == LOGTIMER)
|
||||||
|
{
|
||||||
|
UpdateAboutStatistics();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
HWND OpenAboutDialog(HWND hwndOwner, HINSTANCE instance);
|
HWND OpenAboutDialog(HWND hwndOwner, HINSTANCE instance);
|
||||||
void UpdateAboutDialog();
|
void UpdateAboutDialog();
|
||||||
void UpdateAboutStatistics(LPCTSTR entryName = NULL);
|
void UpdateAboutStatistics(LPCTSTR entryName = NULL);
|
||||||
|
void ScanPlugins();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user