diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2014-12-21 08:17:45 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2014-12-21 08:17:45 +0000 |
commit | b3ded48d866f59df3c9e8634eabe6e62596ad2d5 (patch) | |
tree | a7a9f2cdd1a9846b7445e8ec6babbecee79c8c0b /plugins/Popup/src/history.cpp | |
parent | b2ba573600e650273800774c7fad23268019a353 (diff) |
Popup: changed warning level to w4
git-svn-id: http://svn.miranda-ng.org/main/trunk@11550 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Popup/src/history.cpp')
-rw-r--r-- | plugins/Popup/src/history.cpp | 270 |
1 files changed, 135 insertions, 135 deletions
diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index edc3a66d0b..2d794a62a1 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -2,9 +2,9 @@ Popup Plus plugin for Miranda IM
Copyright © 2002 Luca Santarelli,
- © 2004-2007 Victor Pavlychko
- © 2010 MPK
- © 2010 Merlin_de
+© 2004-2007 Victor Pavlychko
+© 2010 MPK
+© 2010 Merlin_de
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -62,8 +62,8 @@ void PopupHistoryLoad() void PopupHistoryUnload()
{
- for (int i=0; i < arPopupHistory.getCount(); ++i)
- FreeHistoryItem( arPopupHistory[i] );
+ for (int i = 0; i < arPopupHistory.getCount(); ++i)
+ FreeHistoryItem(arPopupHistory[i]);
arPopupHistory.destroy();
DeleteCriticalSection(&csPopupHistory);
@@ -74,7 +74,7 @@ void PopupHistoryAdd(POPUPDATA2 *ppdNew) if (!PopupOptions.EnableHistory)
return;
- POPUPDATA2 *ppd = (POPUPDATA2*)mir_alloc( sizeof(POPUPDATA2));
+ POPUPDATA2 *ppd = (POPUPDATA2*)mir_alloc(sizeof(POPUPDATA2));
*ppd = *ppdNew;
if (ppd->flags & PU2_UNICODE) {
ppd->lptzTitle = mir_tstrdup(ppd->lpwzTitle);
@@ -117,7 +117,7 @@ void PopupHistoryShow() }
}
-static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lParam)
{
static int oldWidth = 0;
static int loadItem = -1;
@@ -127,104 +127,104 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA switch (msg) {
case WM_INITDIALOG:
- {
- oldWidth = 0;
- HWND hwndList = GetDlgItem(hwnd, IDC_POPUP_LIST);
- for (int i=0; i < arPopupHistory.getCount(); ++i)
- ListBox_SetItemData(hwndList, ListBox_AddString(hwndList, _T("")), 0);
- SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(ICO_HISTORY,0));
- SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(ICO_HISTORY,1));
-
- if (gbHppInstalled && PopupOptions.UseHppHistoryLog) {
- logType = LOG_HPP;
- ShowWindow(GetDlgItem(hwnd, IDC_POPUP_LIST), SW_HIDE);
-
- IEVIEWWINDOW ieWindow;
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
- ieWindow.iType = IEW_CREATE;
- ieWindow.dwFlags = 0;
- ieWindow.dwMode = IEWM_MUCC;
- ieWindow.parent = hwnd;
- ieWindow.x = 0;
- ieWindow.y = 0;
- ieWindow.cx = 100;
- ieWindow.cy = 100;
- CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
- hwndLog = ieWindow.hwnd;
- ShowWindow(hwndLog, SW_SHOW);
-
- RECT rcLst; GetWindowRect(hwndList, &rcLst);
- POINT pt;
- pt.x = rcLst.left;
- pt.y = rcLst.top;
- ScreenToClient(hwnd, &pt);
-
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
- ieWindow.iType = IEW_SETPOS;
- ieWindow.parent = hwnd;
- ieWindow.hwnd = hwndLog;
- ieWindow.x = pt.x;
- ieWindow.y = pt.y;
- ieWindow.cx = rcLst.right-rcLst.left;
- ieWindow.cy = rcLst.bottom-rcLst.top;
- CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
-
- IEVIEWEVENTDATA ieData;
-
- IEVIEWEVENT ieEvent;
- ieEvent.cbSize = sizeof(ieEvent);
- ieEvent.iType = IEE_LOG_MEM_EVENTS;
- ieEvent.dwFlags = 0;
- ieEvent.hwnd = hwndLog;
- ieEvent.eventData = &ieData;
- ieEvent.count = 1;
- ieEvent.codepage = 0;
- ieEvent.pszProto = NULL;
-
- for (int i=0; i < arPopupHistory.getCount(); ++i) {
- POPUPDATA2* ppd = arPopupHistory[i];
- ieData.cbSize = sizeof(ieData);
- ieData.iType = IEED_EVENT_SYSTEM;
- ieData.dwFlags = 0;
- ieData.color = ppd->colorText;
- if (ppd->flags & PU2_UNICODE) {
- ieData.dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK;
- ieData.pszNickW = ppd->lptzTitle;
- ieData.pszTextW = ppd->lptzText;
- ieData.pszText2W = NULL;
- }
- else {
- ieData.dwFlags |= 0;
- ieData.pszNick = ppd->lpzTitle;
- ieData.pszText = ppd->lpzText;
- ieData.pszText2 = NULL;
- }
- ieData.bIsMe = FALSE;
- ieData.time = ppd->dwTimestamp;
- ieData.dwData = 0;
- ieData.next = NULL;
- CallService(MS_HPP_EG_EVENT, 0, (WPARAM)&ieEvent);
+ {
+ oldWidth = 0;
+ HWND hwndList = GetDlgItem(hwnd, IDC_POPUP_LIST);
+ for (int i = 0; i < arPopupHistory.getCount(); ++i)
+ ListBox_SetItemData(hwndList, ListBox_AddString(hwndList, _T("")), 0);
+ SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(ICO_HISTORY, 0));
+ SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(ICO_HISTORY, 1));
+
+ if (gbHppInstalled && PopupOptions.UseHppHistoryLog) {
+ logType = LOG_HPP;
+ ShowWindow(GetDlgItem(hwnd, IDC_POPUP_LIST), SW_HIDE);
+
+ IEVIEWWINDOW ieWindow;
+ ieWindow.cbSize = sizeof(IEVIEWWINDOW);
+ ieWindow.iType = IEW_CREATE;
+ ieWindow.dwFlags = 0;
+ ieWindow.dwMode = IEWM_MUCC;
+ ieWindow.parent = hwnd;
+ ieWindow.x = 0;
+ ieWindow.y = 0;
+ ieWindow.cx = 100;
+ ieWindow.cy = 100;
+ CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
+ hwndLog = ieWindow.hwnd;
+ ShowWindow(hwndLog, SW_SHOW);
+
+ RECT rcLst; GetWindowRect(hwndList, &rcLst);
+ POINT pt;
+ pt.x = rcLst.left;
+ pt.y = rcLst.top;
+ ScreenToClient(hwnd, &pt);
+
+ ieWindow.cbSize = sizeof(IEVIEWWINDOW);
+ ieWindow.iType = IEW_SETPOS;
+ ieWindow.parent = hwnd;
+ ieWindow.hwnd = hwndLog;
+ ieWindow.x = pt.x;
+ ieWindow.y = pt.y;
+ ieWindow.cx = rcLst.right - rcLst.left;
+ ieWindow.cy = rcLst.bottom - rcLst.top;
+ CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
+
+ IEVIEWEVENTDATA ieData;
+
+ IEVIEWEVENT ieEvent;
+ ieEvent.cbSize = sizeof(ieEvent);
+ ieEvent.iType = IEE_LOG_MEM_EVENTS;
+ ieEvent.dwFlags = 0;
+ ieEvent.hwnd = hwndLog;
+ ieEvent.eventData = &ieData;
+ ieEvent.count = 1;
+ ieEvent.codepage = 0;
+ ieEvent.pszProto = NULL;
+
+ for (int i = 0; i < arPopupHistory.getCount(); ++i) {
+ POPUPDATA2* ppd = arPopupHistory[i];
+ ieData.cbSize = sizeof(ieData);
+ ieData.iType = IEED_EVENT_SYSTEM;
+ ieData.dwFlags = 0;
+ ieData.color = ppd->colorText;
+ if (ppd->flags & PU2_UNICODE) {
+ ieData.dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK;
+ ieData.pszNickW = ppd->lptzTitle;
+ ieData.pszTextW = ppd->lptzText;
+ ieData.pszText2W = NULL;
}
+ else {
+ ieData.dwFlags |= 0;
+ ieData.pszNick = ppd->lpzTitle;
+ ieData.pszText = ppd->lpzText;
+ ieData.pszText2 = NULL;
+ }
+ ieData.bIsMe = FALSE;
+ ieData.time = ppd->dwTimestamp;
+ ieData.dwData = 0;
+ ieData.next = NULL;
+ CallService(MS_HPP_EG_EVENT, 0, (WPARAM)&ieEvent);
}
- else {
- logType = LOG_DEFAULT;
- hwndLog = hwndList;
+ }
+ else {
+ logType = LOG_DEFAULT;
+ hwndLog = hwndList;
- ShowWindow(hwndLog, SW_SHOW);
- }
+ ShowWindow(hwndLog, SW_SHOW);
+ }
- Utils_RestoreWindowPosition(hwnd, NULL, MODULNAME, "popupHistory_");
+ Utils_RestoreWindowPosition(hwnd, NULL, MODULNAME, "popupHistory_");
- if (logType == LOG_DEFAULT) {
- SendMessage(hwnd, UM_RESIZELIST, 0, 0);
- ListBox_SetTopIndex(hwndLog, arPopupHistory.getCount()-1);
- }
+ if (logType == LOG_DEFAULT) {
+ SendMessage(hwnd, UM_RESIZELIST, 0, 0);
+ ListBox_SetTopIndex(hwndLog, arPopupHistory.getCount() - 1);
}
- return TRUE;
+ }
+ return TRUE;
case WM_MEASUREITEM:
if (logType == LOG_DEFAULT) {
- LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT) lParam;
+ LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT)lParam;
if (lpmis->itemID == -1)
return FALSE;
lpmis->itemHeight = 50;
@@ -234,7 +234,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA case WM_DRAWITEM:
if (logType == LOG_DEFAULT) {
LPDRAWITEMSTRUCT lpdis;
- lpdis = (LPDRAWITEMSTRUCT) lParam;
+ lpdis = (LPDRAWITEMSTRUCT)lParam;
if (lpdis->itemID == -1)
return FALSE;
@@ -248,7 +248,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA POPUPOPTIONS customOptions = PopupOptions;
customOptions.DynamicResize = FALSE;
- customOptions.MinimumWidth = customOptions.MaximumWidth = rc.right-rc.left-30;
+ customOptions.MinimumWidth = customOptions.MaximumWidth = rc.right - rc.left - 30;
POPUPDATA2 *ppd = arPopupHistory[lpdis->itemID];
wndPreview = new PopupWnd2(ppd, &customOptions, true);
@@ -256,7 +256,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA wndPreview->update();
ListBox_SetItemData(hwndLog, lpdis->itemID, wndPreview);
- ListBox_SetItemHeight(hwndLog, lpdis->itemID, wndPreview->getSize().cy+6);
+ ListBox_SetItemHeight(hwndLog, lpdis->itemID, wndPreview->getSize().cy + 6);
}
if (wndPreview) {
@@ -264,7 +264,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA HBRUSH hbr = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT));
FillRect(lpdis->hDC, &lpdis->rcItem, hbr);
DeleteObject(hbr);
- }
+ }
else {
HBRUSH hbr = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
FillRect(lpdis->hDC, &lpdis->rcItem, hbr);
@@ -279,7 +279,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA bf.BlendFlags = 0;
bf.SourceConstantAlpha = 255;
bf.AlphaFormat = AC_SRC_ALPHA;
- AlphaBlend(lpdis->hDC, lpdis->rcItem.left+5, lpdis->rcItem.top+3, width, height,
+ AlphaBlend(lpdis->hDC, lpdis->rcItem.left + 5, lpdis->rcItem.top + 3, width, height,
wndPreview->getContent()->getDC(),
0, 0, width, height, bf);
}
@@ -296,48 +296,48 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA return TRUE;
case WM_SIZE:
- {
- RECT rcLst; GetClientRect(hwnd, &rcLst);
- rcLst.left += 10;
- rcLst.top += 10;
- rcLst.right -= 10;
- rcLst.bottom -= 10;
- if (logType == LOG_HPP) {
- SetWindowPos(hwndLog, NULL,
- rcLst.left, rcLst.top, rcLst.right-rcLst.left, rcLst.bottom-rcLst.top,
- SWP_NOZORDER|SWP_DEFERERASE|SWP_SHOWWINDOW);
-
- IEVIEWWINDOW ieWindow;
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
- ieWindow.iType = IEW_SETPOS;
- ieWindow.parent = hwnd;
- ieWindow.hwnd = hwndLog;
- ieWindow.x = rcLst.left;
- ieWindow.y = rcLst.top;
- ieWindow.cx = rcLst.right-rcLst.left;
- ieWindow.cy = rcLst.bottom-rcLst.top;
- CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
- }
- else if (logType == LOG_DEFAULT) {
- SetWindowPos(hwndLog, NULL,
- rcLst.left, rcLst.top, rcLst.right-rcLst.left, rcLst.bottom-rcLst.top,
- SWP_NOZORDER | SWP_DEFERERASE | SWP_SHOWWINDOW);
- if (rcLst.right-rcLst.left != oldWidth) {
- oldWidth = rcLst.right-rcLst.left;
- PostMessage(hwnd, UM_RESIZELIST, 0, 0);
- }
+ {
+ RECT rcLst; GetClientRect(hwnd, &rcLst);
+ rcLst.left += 10;
+ rcLst.top += 10;
+ rcLst.right -= 10;
+ rcLst.bottom -= 10;
+ if (logType == LOG_HPP) {
+ SetWindowPos(hwndLog, NULL,
+ rcLst.left, rcLst.top, rcLst.right - rcLst.left, rcLst.bottom - rcLst.top,
+ SWP_NOZORDER | SWP_DEFERERASE | SWP_SHOWWINDOW);
+
+ IEVIEWWINDOW ieWindow;
+ ieWindow.cbSize = sizeof(IEVIEWWINDOW);
+ ieWindow.iType = IEW_SETPOS;
+ ieWindow.parent = hwnd;
+ ieWindow.hwnd = hwndLog;
+ ieWindow.x = rcLst.left;
+ ieWindow.y = rcLst.top;
+ ieWindow.cx = rcLst.right - rcLst.left;
+ ieWindow.cy = rcLst.bottom - rcLst.top;
+ CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
+ }
+ else if (logType == LOG_DEFAULT) {
+ SetWindowPos(hwndLog, NULL,
+ rcLst.left, rcLst.top, rcLst.right - rcLst.left, rcLst.bottom - rcLst.top,
+ SWP_NOZORDER | SWP_DEFERERASE | SWP_SHOWWINDOW);
+ if (rcLst.right - rcLst.left != oldWidth) {
+ oldWidth = rcLst.right - rcLst.left;
+ PostMessage(hwnd, UM_RESIZELIST, 0, 0);
}
}
- return TRUE;
+ }
+ return TRUE;
case UM_RESIZELIST:
if (logType == LOG_DEFAULT) {
- RECT rc;
+ RECT rc;
GetWindowRect(GetDlgItem(hwnd, IDC_POPUP_LIST), &rc);
- if (rc.right-rc.left <= 30)
+ if (rc.right - rc.left <= 30)
return FALSE;
- for (int i=0; i < arPopupHistory.getCount(); ++i) {
+ for (int i = 0; i < arPopupHistory.getCount(); ++i) {
PopupWnd2 *wndPreview = (PopupWnd2 *)ListBox_GetItemData(hwndLog, i);
if (wndPreview)
delete wndPreview;
|