Changes by JamesAC and spx to the "About" dialog.

This commit is contained in:
jsmorley 2010-08-26 20:50:36 +00:00
parent 494a7c77ce
commit d9137c2413
8 changed files with 220 additions and 153 deletions

View File

@ -28,8 +28,8 @@ LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,0,515
PRODUCTVERSION 1,3,0,515
FILEVERSION 1,3,0,520
PRODUCTVERSION 1,3,0,520
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -45,12 +45,12 @@ BEGIN
BLOCK "040b04b0"
BEGIN
VALUE "FileDescription", "Rainmeter - A Customizable Resource Meter"
VALUE "FileVersion", "1, 3, 0, 515"
VALUE "FileVersion", "1, 3, 0, 520"
VALUE "InternalName", "Rainmeter"
VALUE "LegalCopyright", "Copyright (C) 2010 - Rainy"
VALUE "OriginalFilename", "Rainmeter.exe"
VALUE "ProductName", "Rainmeter"
VALUE "ProductVersion", "1, 3, 0, 515"
VALUE "ProductVersion", "1, 3, 0, 520"
END
END
BLOCK "VarFileInfo"

View File

@ -29,6 +29,7 @@ extern CRainmeter* Rainmeter;
INT_PTR CALLBACK AboutProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam);
HWND g_DialogWin = NULL;
VOID UpdateWidgets(HWND window);
struct PLUGIN_INFO
{
@ -61,19 +62,56 @@ void UpdateAboutStatistics()
if (g_DialogWin != NULL && IsWindowVisible(g_DialogWin))
{
HWND widget;
widget = GetDlgItem(g_DialogWin, IDC_CONFIG_TAB);
int selected = TabCtrl_GetCurSel(widget);
widget = GetDlgItem(g_DialogWin, IDC_ABOUT_ENTRIES);
int selected = (int)SendMessage(widget, LB_GETCURSEL, NULL, NULL);
int count = (int)SendMessage(widget, LB_GETCOUNT, NULL, NULL);
int current = 0;
widget = GetDlgItem(g_DialogWin, IDC_STATISTICS);
SendMessage(widget, WM_SETREDRAW, 0, 0);
if (selected == 0)
{
int count = ListView_GetItemCount(widget);
std::list<CRainmeter::LOG_INFO>::const_iterator iter = Rainmeter->m_LogData.begin();
LVITEM vitem;
vitem.mask = LVIF_TEXT;
int i = 0;
for ( ; iter != Rainmeter->m_LogData.end(); ++iter)
{
if (i < count)
{
ListView_SetItemText(widget, i, 0, (WCHAR*)(*iter).type.c_str());
}
else
{
vitem.iItem = i;
vitem.iSubItem = 0;
vitem.pszText = (WCHAR*)(*iter).type.c_str();
ListView_InsertItem(widget, &vitem);
}
ListView_SetItemText(widget, i, 1, (WCHAR*)(*iter).timestamp.c_str());
ListView_SetItemText(widget, i, 2, (WCHAR*)(*iter).message.c_str());
++i;
}
}
else if (selected == 2)
{
widget = GetDlgItem(g_DialogWin, IDC_ABOUT_ENTRIES);
SendMessage(widget, LB_SETCURSEL, 1, NULL);
UpdateWidgets(g_DialogWin);
}
else if (selected > 2)
{
std::map<std::wstring, CMeterWindow*>& windows = Rainmeter->GetAllMeterWindows();
std::map<std::wstring, CMeterWindow*>::const_iterator iter = windows.begin();
for( ; iter != windows.end(); ++iter)
{
if (current == selected)
if (current == selected - 3)
{
int count = ListView_GetItemCount(widget);
@ -126,7 +164,7 @@ void UpdateAboutStatistics()
}
++current;
}
}
SendMessage(widget, WM_SETREDRAW, 1, 0);
}
}
@ -134,14 +172,25 @@ void UpdateAboutStatistics()
void UpdateWidgets(HWND window)
{
HWND widget;
widget = GetDlgItem(g_DialogWin, IDC_CONFIG_TAB);
int selected = TabCtrl_GetCurSel(widget);
int count = TabCtrl_GetItemCount(widget);
widget = GetDlgItem(g_DialogWin, IDC_ABOUT_ENTRIES);
int selected = (int)SendMessage(widget, LB_GETCURSEL, NULL, NULL);
int count = (int)SendMessage(widget, LB_GETCOUNT, NULL, NULL);
widget = GetDlgItem(g_DialogWin, IDC_STATISTICS);
ListView_DeleteAllItems(widget);
if (count == selected + 1)
if (selected == 0)
{
LVCOLUMN lvc;
lvc.mask = LVCF_TEXT;
lvc.pszText = L"Log Type";
ListView_SetColumn(widget, 0, &lvc);
lvc.pszText = L"Time";
ListView_SetColumn(widget, 1, &lvc);
lvc.pszText = L"Message";
ListView_SetColumn(widget, 2, &lvc);
}
else if (selected == 1)
{
LVCOLUMN lvc;
lvc.mask = LVCF_TEXT;
@ -284,12 +333,12 @@ void RepositionControls(HWND hwndDlg)
MapWindowPoints(widget, hwndDlg, (LPPOINT)&wr, 2);
SetWindowPos(widget, NULL, ((r.right - (wr.right - wr.left)) / 2) + 9, wr.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
widget = GetDlgItem(hwndDlg, IDC_CONFIG_TAB);
SetWindowPos(widget, NULL, 0, 0, r.right - 22, r.bottom - 175, SWP_NOMOVE | SWP_NOZORDER);
widget = GetDlgItem(hwndDlg, IDC_ABOUT_ENTRIES);
SetWindowPos(widget, NULL, 0, 0, (r.right - 28) / 3, r.bottom - 170, SWP_NOMOVE | SWP_NOZORDER);
widget = GetDlgItem(hwndDlg, IDC_STATISTICS);
SetWindowPos(widget, NULL, 0, 0, r.right - 44, r.bottom - 210, SWP_NOMOVE | SWP_NOZORDER);
SetWindowPos(widget, NULL, 18 + ((r.right - 28) / 3), 130, 2 * ((r.right - 28) / 3), r.bottom - 170, SWP_NOZORDER);
widget = GetDlgItem(hwndDlg, IDOK);
SetWindowPos(widget, NULL, (r.right - br.right) / 2, r.bottom - br.bottom - 11, br.right, br.bottom, SWP_NOZORDER);
SetWindowPos(widget, NULL, (r.right - br.right) / 2, r.bottom - br.bottom - 9, br.right, br.bottom, SWP_NOZORDER);
}
BOOL OnInitAboutDialog(HWND window)
@ -305,22 +354,27 @@ BOOL OnInitAboutDialog(HWND window)
swprintf(tmpSz, L"Built on %s", ConvertToWide(__DATE__).c_str());
SetWindowText(widget, tmpSz);
// Add tabs for each config
widget = GetDlgItem(window, IDC_CONFIG_TAB);
TCITEM tie;
tie.mask = TCIF_TEXT;
// Add entries for each config
widget = GetDlgItem(window, IDC_ABOUT_ENTRIES);
std::map<std::wstring, CMeterWindow*>& windows = Rainmeter->GetAllMeterWindows();
std::map<std::wstring, CMeterWindow*>::const_iterator iter = windows.begin();
int i = 0;
for( ; iter != windows.end(); ++iter)
{
CMeterWindow* meterWindow = (*iter).second;
wchar_t* skinName = (WCHAR*)meterWindow->GetSkinName().c_str();
SendMessage(widget, LB_ADDSTRING, NULL, (LPARAM) skinName);
size_t namelength = wcslen(skinName);
tie.pszText = (WCHAR*)meterWindow->GetSkinName().c_str();
TabCtrl_InsertItem(widget, i++, &tie);
int currwidth = (INT)SendMessage(widget, LB_GETHORIZONTALEXTENT, NULL, NULL);
if(6 * namelength > currwidth)
{
SendMessage(widget, LB_SETHORIZONTALEXTENT, 6 * namelength, NULL);
}
tie.pszText = L"Plugins";
TabCtrl_InsertItem(widget, i, &tie);
}
SendMessage(widget, LB_INSERTSTRING, 0, (LPARAM) L"Log");
SendMessage(widget, LB_INSERTSTRING, 1, (LPARAM) L"Plugins");
SendMessage(widget, LB_INSERTSTRING, 2, (LPARAM) L"--------------------");
// Add columns to the list view
widget = GetDlgItem(window, IDC_STATISTICS);
@ -331,15 +385,15 @@ BOOL OnInitAboutDialog(HWND window)
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvc.iSubItem = 0;
lvc.pszText = L"Measure";
lvc.cx = 150;
lvc.cx = 110;
lvc.fmt = LVCFMT_LEFT; // left-aligned column
ListView_InsertColumn(widget, 0, &lvc);
lvc.iSubItem = 1;
lvc.cx = 130;
lvc.cx = 100;
lvc.pszText = L"Value";
ListView_InsertColumn(widget, 1, &lvc);
lvc.iSubItem = 1;
lvc.cx = 130;
lvc.cx = 150;
lvc.pszText = L"Range";
ListView_InsertColumn(widget, 2, &lvc);
@ -374,17 +428,6 @@ INT_PTR CALLBACK AboutProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lPa
RepositionControls(hwndDlg);
break;
case WM_NOTIFY:
{
LPNMHDR lpnmhdr = (LPNMHDR)lParam;
if (lpnmhdr->code == TCN_SELCHANGE)
{
UpdateWidgets(hwndDlg);
UpdateAboutStatistics();
}
}
break;
case WM_CLOSE:
Rainmeter->SaveSettings();
DestroyWindow(hwndDlg);
@ -410,6 +453,14 @@ INT_PTR CALLBACK AboutProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lPa
DestroyWindow(hwndDlg);
g_DialogWin = NULL;
return TRUE;
case IDC_ABOUT_ENTRIES:
if (HIWORD(wParam) == LBN_SELCHANGE)
{
UpdateWidgets(hwndDlg);
UpdateAboutStatistics();
}
break;
}
break;
}

View File

@ -1,4 +1,4 @@
//Microsoft Developer Studio generated resource script.
// Microsoft Developer Studio generated resource script.
//
#include "resource.h"
@ -143,23 +143,21 @@ END
// Dialog
//
IDD_ABOUT_DIALOG DIALOG DISCARDABLE 0, 0, 351, 225
STYLE DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
IDD_ABOUT_DIALOG DIALOGEX DISCARDABLE 0, 0, 370, 240
STYLE DS_SETFONT | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_APPWINDOW
CAPTION "About Rainmeter"
FONT 8, "MS Shell Dlg 2"
FONT 8, "MS Shell Dlg 2", 0, 0, 0x0
BEGIN
CONTROL "List1",IDC_STATISTICS,"SysListView32",LVS_REPORT |
LVS_SINGLESEL | LVS_NOSORTHEADER | WS_BORDER |
WS_TABSTOP,14,98,309,98
CTEXT "Get the latest version at: http://www.rainmeter.net",
IDC_URL_STRING,15,43,300,8
CONTROL "List1",IDC_STATISTICS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,118,80,211,100
CTEXT "Get the latest version at: http://www.rainmeter.net",IDC_URL_STRING,15,43,300,8
CTEXT "Rainmeter version 0.0",IDC_VERSION_STRING,15,17,300,8
CONTROL "Tab1",IDC_CONFIG_TAB,"SysTabControl32",0x0,7,81,220,120
GROUPBOX "About",IDC_STATIC_ABOUT,7,7,220,69
CTEXT "(Built on ??? ?? ????)",IDC_BUILD_STRING,15,30,300,8
DEFPUSHBUTTON "OK",IDOK,91,204,50,14
CONTROL "Disable check for updates",IDC_DISABLE_VERSION_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,67,56,104,10
LISTBOX IDC_ABOUT_ENTRIES,7,80,130,100,LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
END

View File

@ -508,6 +508,9 @@ std::wstring ConvertToWide(LPCSTR str)
BOOL LSLog(int nLevel, LPCTSTR pszModule, LPCTSTR pszMessage)
{
CRainmeter::LOG_INFO logInfo;
logInfo.message = pszMessage;
// Add timestamp
static DWORD startTime = 0;
@ -520,6 +523,7 @@ BOOL LSLog(int nLevel, LPCTSTR pszModule, LPCTSTR pszMessage)
swprintf(buffer, L"(%02i:%02i:%02i.%03i) ", (time - startTime) / (1000 * 60* 60), ((time - startTime) / (1000 * 60)) % 60, ((time - startTime) / 1000) % 60, (time - startTime) % 1000);
std::wstring message(buffer);
logInfo.timestamp = message;
message += pszMessage;
#ifdef _DEBUG
@ -527,6 +531,23 @@ BOOL LSLog(int nLevel, LPCTSTR pszModule, LPCTSTR pszMessage)
_RPT0(_CRT_WARN, "\n");
#endif
switch(nLevel)
{
case 1:
logInfo.type = L"ERROR";
break;
case 2:
logInfo.type = L"WARNING";
break;
case 3:
logInfo.type = L"NOTICE";
break;
case 4:
logInfo.type = L"DEBUG";
break;
}
Rainmeter->m_LogData.push_front(logInfo);
// Use the lsapi.dll version of the method if possible
if (fpLSLog)
{
@ -568,21 +589,7 @@ BOOL LSLog(int nLevel, LPCTSTR pszModule, LPCTSTR pszMessage)
FILE* logFile = _wfopen(logfile.c_str(), L"a+, ccs=UTF-8");
if (logFile)
{
switch(nLevel)
{
case 1:
fputws(L"ERROR: ", logFile);
break;
case 2:
fputws(L"WARNING: ", logFile);
break;
case 3:
fputws(L"NOTICE: ", logFile);
break;
case 4:
fputws(L"DEBUG: ", logFile);
break;
}
fputws(logInfo.type.c_str(), logFile);
fputws(message.c_str(), logFile);
fputws(L"\n", logFile);
fclose(logFile);
@ -590,7 +597,10 @@ BOOL LSLog(int nLevel, LPCTSTR pszModule, LPCTSTR pszMessage)
}
}
}
if (Rainmeter->m_LogData.size() > MAXABOUTLOGLINES)
{
Rainmeter->m_LogData.pop_back();
}
return TRUE;
}

View File

@ -28,6 +28,7 @@
#define LM_GETREVID 9265
#define LM_REGISTERMESSAGE 9263
#define LM_UNREGISTERMESSAGE 9264
#define MAXABOUTLOGLINES 20
#ifdef _DEBUG
#define DEBUGLOG DebugLog

View File

@ -136,6 +136,13 @@ public:
std::vector<CONFIGMENU> children;
};
struct LOG_INFO
{
std::wstring type;
std::wstring timestamp;
std::wstring message;
};
CRainmeter();
~CRainmeter();
@ -196,6 +203,7 @@ public:
void StartLogging();
void StopLogging();
void DeleteLogFile();
std::list<LOG_INFO> m_LogData;
void SetDebug(bool debug);

View File

@ -1,5 +1,5 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Microsoft Visual C++ generated include file.
// Used by Library.rc
//
#define IDR_CONTEXT_MENU 101
@ -13,7 +13,7 @@
#define IDC_STATISTICS_STRING 1003
#define IDC_STATIC_ABOUT 1004
#define IDC_URL_STRING 1005
#define IDC_CONFIG_TAB 1006
#define IDC_ABOUT_ENTRIES 1006
#define IDC_AUTHOR_STRING 1007
#define IDC_DISABLE_VERSION_CHECK 1008
#define ID_CONTEXT_REFRESH 4001
@ -64,7 +64,6 @@
#define ID_CONTEXT_STOPLOG 4052
#define ID_CONTEXT_DEBUGLOG 4053
#define ID_CONTEXT_DELETELOGFILE 4054
#define ID_CONFIG_EDIT 30000
#define ID_CONFIG_FIRST 30001
#define ID_CONFIG_LAST 33000
@ -79,7 +78,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 110
#define _APS_NEXT_COMMAND_VALUE 4040
#define _APS_NEXT_CONTROL_VALUE 1010
#define _APS_NEXT_CONTROL_VALUE 1013
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -1,3 +1,3 @@
#pragma once
const int revision_number = 515;
const int revision_number = 520;
const bool revision_beta = true;