From aaf3d972a3b32623f7e2984382adc5ca633bb280 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 26 Oct 2012 12:12:58 +0000 Subject: attemp to fix crash in Popups history git-svn-id: http://svn.miranda-ng.org/main/trunk@2084 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Popup/src/actions.cpp | 8 +- plugins/Popup/src/bitmap_funcs.cpp | 36 ++-- plugins/Popup/src/font.cpp | 2 +- plugins/Popup/src/history.cpp | 374 ++++++++++++++---------------------- plugins/Popup/src/icons.cpp | 2 +- plugins/Popup/src/notifications.cpp | 8 +- plugins/Popup/src/opt_adv.cpp | 4 +- plugins/Popup/src/opt_class.cpp | 8 +- plugins/Popup/src/opt_contacts.cpp | 8 +- plugins/Popup/src/opt_gen.cpp | 6 +- plugins/Popup/src/opt_skins.cpp | 6 +- plugins/Popup/src/popup_thread.cpp | 6 +- plugins/Popup/src/popup_wnd2.cpp | 4 +- plugins/Popup/src/services.cpp | 2 +- plugins/Popup/src/skin.cpp | 16 +- plugins/Popup/src/srmm_menu.cpp | 2 +- 16 files changed, 207 insertions(+), 285 deletions(-) (limited to 'plugins/Popup/src') diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index 9aa0506d21..395599d0c1 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -62,13 +62,13 @@ void LoadActions() }; - for (int i = 0; i < SIZEOF(actions); ++i) + for (int i=0; i < SIZEOF(actions); ++i) RegisterAction(&actions[i]); } void UnloadActions() { -// for (int i = 0; i < gActions.getCount(); ++i) +// for (int i=0; i < gActions.getCount(); ++i) // delete gActions[i]; gActions.destroy(); } @@ -329,7 +329,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); BOOL enabled = (PopUpOptions.actions&ACT_ENABLE) ? TRUE : FALSE; - for (int i = 0; i < SIZEOF(controls); ++i) + for (int i=0; i < SIZEOF(controls); ++i) EnableWindow(GetDlgItem(hwnd, controls[i]), enabled); break; } @@ -402,7 +402,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM { DBWriteContactSettingDword(NULL, MODULNAME, "Actions", PopUpOptions.actions); HWND hwndList = GetDlgItem(hwnd, IDC_ACTIONS); - for (int i = 0; i < gActions.getCount(); ++i) + for (int i=0; i < gActions.getCount(); ++i) { gActions[i]->flags = (ListView_GetItemState(hwndList, i, LVIS_STATEIMAGEMASK) == 0x2000) ? PAF_ENABLED : 0; DBWriteContactSettingByte(NULL, "PopUpActions", gActions[i]->lpzTitle, (gActions[i]->flags&PAF_ENABLED) ? 1 : 0); diff --git a/plugins/Popup/src/bitmap_funcs.cpp b/plugins/Popup/src/bitmap_funcs.cpp index 80931ee40d..de731f35cb 100644 --- a/plugins/Popup/src/bitmap_funcs.cpp +++ b/plugins/Popup/src/bitmap_funcs.cpp @@ -86,7 +86,7 @@ void MyBitmap::makeOpaque() if (!bits) return; GdiFlush(); - for (int i = 0; i < width*height; i++) + for (int i=0; i < width*height; i++) bits[i] |= 0xff000000; } @@ -120,7 +120,7 @@ void MyBitmap::saveAlpha(int x, int y, int w, int h) bitsSave = new COLOR32[w*h]; COLOR32 *p1 = bitsSave; - for (int i = 0; i < h; i++) + for (int i=0; i < h; i++) { if (i+y < 0) continue; if (i+y >= height) break; @@ -146,7 +146,7 @@ void MyBitmap::restoreAlpha(int x, int y, int w, int h) COLOR32 *p1 = bitsSave; - for (int i = 0; i < h; i++) + for (int i=0; i < h; i++) { if (i+y < 0) continue; if (i+y >= height) break; @@ -185,7 +185,7 @@ void MyBitmap::DrawBits(COLOR32 *inbits, int inw, int inh, int x, int y, int w, if (y+h >= this->getHeight()) h = this->getHeight() - y; - for (int i = 0; i < h; i++) + for (int i=0; i < h; i++) { if (i+y < 0) continue; if (i+y >= height) break; @@ -212,7 +212,7 @@ void MyBitmap::BlendBits(COLOR32 *inbits, int inw, int inh, int x, int y, int w, if (y+h >= this->getHeight()) h = this->getHeight() - y; - for (int i = 0; i < h; i++) + for (int i=0; i < h; i++) { if (i+y < 0) continue; if (i+y >= height) break; @@ -249,7 +249,7 @@ void MyBitmap::Blend(MyBitmap *bmp, int x, int y, int w, int h) if (y+h >= this->getHeight()) h = this->getHeight() - y; - for (int i = 0; i < h; i++) + for (int i=0; i < h; i++) { if (i+y < 0) continue; if (i+y >= height) break; @@ -294,7 +294,7 @@ void MyBitmap::Draw(MyBitmap *bmp, int x, int y, int w, int h) if (y+h >= this->getHeight()) h = this->getHeight() - y; - for (int i = 0; i < h; i++) + for (int i=0; i < h; i++) { if (i+y < 0) continue; if (i+y >= height) break; @@ -331,7 +331,7 @@ void MyBitmap::BlendColorized(MyBitmap *bmp, int x, int y, int w, int h, COLOR32 float koef2g = (getg(color)) / 128.0; float koef2b = (getr(color)) / 128.0; - for (int i = 0; i < h; i++) + for (int i=0; i < h; i++) { if (i+y < 0) continue; if (i+y >= height) break; @@ -403,7 +403,7 @@ void MyBitmap::DrawColorized(MyBitmap *bmp, int x, int y, int w, int h, COLOR32 float koef2g = (getg(color)) / 128.0; float koef2b = (getr(color)) / 128.0; - for (int i = 0; i < h; i++) + for (int i=0; i < h; i++) { if (i+y < 0) continue; if (i+y >= height) break; @@ -453,7 +453,7 @@ void MyBitmap::BlendPart(MyBitmap *bmp, int xin, int yin, int win, int hin, int if (y+h >= this->getHeight()) h = this->getHeight() - y; - for (int i = 0; i < h; i++) + for (int i=0; i < h; i++) { if (i+y < 0) continue; if (i+y >= height) break; @@ -505,7 +505,7 @@ void MyBitmap::BlendPartColorized(MyBitmap *bmp, int xin, int yin, int win, int float koef2g = (getg(color)) / 128.0; float koef2b = (getr(color)) / 128.0; - for (int i = 0; i < h; i++) + for (int i=0; i < h; i++) { if (i+y < 0) continue; if (i+y >= height) break; @@ -575,7 +575,7 @@ void MyBitmap::DrawPart(MyBitmap *bmp, int xin, int yin, int win, int hin, int x if (y+h >= this->getHeight()) h = this->getHeight() - y; - for (int i = 0; i < h; i++) + for (int i=0; i < h; i++) { if (i+y < 0) continue; if (i+y >= height) break; @@ -594,7 +594,7 @@ void MyBitmap::DrawNoAlpha(MyBitmap *bmp, int x, int y, int w, int h) GdiFlush(); - for (int i = 0; i < bmp->height; i++) + for (int i=0; i < bmp->height; i++) { if (i+y < 0) continue; if (i+y >= height) break; @@ -639,7 +639,7 @@ void MyBitmap::DrawIcon(HICON hic, int x, int y, int w, int h) GetBitmapBits(info.hbmColor, bmpColor.bmWidthBytes*bmpColor.bmHeight, cbit); GetBitmapBits(info.hbmMask, bmpMask.bmWidthBytes*bmpMask.bmHeight, mbit); - for (int i = 0; i < bmpColor.bmHeight; i++) + for (int i=0; i < bmpColor.bmHeight; i++) { for (int j = 0; j < bmpColor.bmWidth; j++) { @@ -714,7 +714,7 @@ HRGN MyBitmap::buildOpaqueRgn(int level, bool opaque) int first = 0; bool wasfirst = false; bool ismask = false; - for (int i = 0; i < height; i++) + for (int i=0; i < height; i++) { int j; // we will need j after the loop! for (j = 0; j < width; j++) @@ -810,7 +810,7 @@ bool MyBitmap::loadFromFile_gradient(const char *fn, const char *fnAlpha) b = (hex2dec(p[4]) << 4) + hex2dec(p[5]); COLOR32 to = rgba(r,g,b,a); - for (int i = 0; i < 256; ++i) + for (int i=0; i < 256; ++i) { bits[i] = rgba( ((255-i) * getr(from) + i * getr(to)) / 255, @@ -923,7 +923,7 @@ bool MyBitmap::loadFromFile_default(const char *fn, const char *fnAlpha) (alpha.getWidth() == width) && (alpha.getHeight() == height)) { - for (int i = 0; i < width*height; i++) + for (int i=0; i < width*height; i++) bits[i] = (bits[i] & 0x00ffffff) | ( (alpha.bits[i] & 0x000000ff) << 24 ); premultipleChannels(); } else @@ -1004,6 +1004,6 @@ void MyBitmap::premultipleChannels() { GdiFlush(); - for (int i = 0; i < width*height; i++) + for (int i=0; i < width*height; i++) bits[i] = rgba(getr(bits[i])*geta(bits[i])/255, getg(bits[i])*geta(bits[i])/255, getb(bits[i])*geta(bits[i])/255, geta(bits[i])); } diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp index 77aca7b94a..5c097b2c7f 100644 --- a/plugins/Popup/src/font.cpp +++ b/plugins/Popup/src/font.cpp @@ -141,7 +141,7 @@ void ReloadFonts() //update class popupps(only temp at this point, must rework) char setting[256]; - for(int i = 0; i < gTreeData.getCount(); i++) { + for(int i=0; i < gTreeData.getCount(); i++) { if(gTreeData[i]->typ == 2) { mir_snprintf(setting, 256, "%s/TextCol", gTreeData[i]->pupClass.pszName); gTreeData[i]->colorText = gTreeData[i]->pupClass.colorText = diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index 6775efe666..4069739f26 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -32,75 +32,45 @@ Last change by : $Author: MPK $ #include "headers.h" -static POPUPDATA2 *popupHistory; -static int popupHistoryStart = 0; -static int popupHistorySize = 0; -static int popupHistoryBuffer = 100; +static LIST arPopupHistory(SETTING_HISTORYSIZE_DEFAULT); +static int popupHistoryBuffer = 0; #define UM_RESIZELIST (WM_USER+100) #define UM_SELECTLAST (WM_USER+101) #define UM_ADDITEM (WM_USER+102) static HWND hwndHistory = NULL; -static inline int getHistoryIndex(int idx) -{ - return (popupHistoryStart + idx) % popupHistoryBuffer; -} +static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -static inline POPUPDATA2 *getHistoryItem(int idx) +static void FreeHistoryItem(POPUPDATA2 *ppd) { - return popupHistory + (popupHistoryStart + idx) % popupHistoryBuffer; + mir_free(ppd->lpzTitle); + mir_free(ppd->lpzText); + mir_free(ppd->lpzSkin); + mir_free(ppd); } -static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); - void PopupHistoryLoad() { popupHistoryBuffer = DBGetContactSettingWord(NULL, MODULNAME, "HistorySize", SETTING_HISTORYSIZE_DEFAULT); - popupHistory = new POPUPDATA2[popupHistoryBuffer]; } void PopupHistoryResize() { - int i; - int toDelete = 0; - int toCopy = popupHistorySize; - if (popupHistoryBuffer == PopUpOptions.HistorySize) return; - if (hwndHistory) PostMessage(hwndHistory, WM_CLOSE, 0, 0); - POPUPDATA2 *oldPopupHistory = popupHistory; - int oldStart = popupHistoryStart; - int oldBuffer = popupHistoryBuffer; - popupHistory = new POPUPDATA2[PopUpOptions.HistorySize]; - popupHistoryStart = 0; - popupHistoryBuffer = PopUpOptions.HistorySize; - if(PopUpOptions.HistorySize < popupHistorySize){ //if old history bigger new one - toDelete = popupHistorySize - PopUpOptions.HistorySize; - toCopy = PopUpOptions.HistorySize; - popupHistorySize = PopUpOptions.HistorySize; - } - for(i = 0; i < toCopy; ++i){ //copy needed - popupHistory[i] = oldPopupHistory[(oldStart + toDelete + i)%oldBuffer]; - } - for(i = 0; i < toDelete; ++i){//free too old ones - POPUPDATA2 *ppd = &oldPopupHistory[(oldStart + i)%oldBuffer]; - mir_free(ppd->lpzTitle); - mir_free(ppd->lpzText); - mir_free(ppd->lpzSkin); + popupHistoryBuffer = PopUpOptions.HistorySize; + + while (arPopupHistory.getCount() > popupHistoryBuffer) { + FreeHistoryItem(arPopupHistory[0]); + arPopupHistory.remove(0); } - delete [] oldPopupHistory; } void PopupHistoryUnload() { - for (int i = 0; i < popupHistorySize; ++i) - { - POPUPDATA2 *ppd = &popupHistory[getHistoryIndex(i)]; - mir_free(ppd->lpzTitle); - mir_free(ppd->lpzText); - mir_free(ppd->lpzSkin); - } - delete [] popupHistory; - popupHistory = NULL; + for (int i=0; i < arPopupHistory.getCount(); ++i) + FreeHistoryItem( arPopupHistory[i] ); + + arPopupHistory.destroy(); } void PopupHistoryAdd(POPUPDATA2 *ppdNew) @@ -108,19 +78,7 @@ void PopupHistoryAdd(POPUPDATA2 *ppdNew) if (!PopUpOptions.EnableHistory) return; - POPUPDATA2 *ppd; - if (popupHistorySize < popupHistoryBuffer) { - ++popupHistorySize; - ppd = &popupHistory[getHistoryIndex(popupHistorySize-1)]; - } - else { - popupHistoryStart = (popupHistoryStart+1)%popupHistoryBuffer; - ppd = &popupHistory[getHistoryIndex(popupHistorySize-1)]; - mir_free(ppd->lpzTitle); - mir_free(ppd->lpzText); - mir_free(ppd->lpzSkin); - } - + POPUPDATA2 *ppd = (POPUPDATA2*)mir_alloc( sizeof(POPUPDATA2)); *ppd = *ppdNew; if (ppd->flags & PU2_UNICODE) { ppd->lpwzTitle = mir_wstrdup(ppd->lpwzTitle); @@ -133,6 +91,12 @@ void PopupHistoryAdd(POPUPDATA2 *ppdNew) ppd->lpzSkin = mir_strdup(ppd->lpzSkin); ppd->dwTimestamp = time(NULL); + if (arPopupHistory.getCount() >= popupHistoryBuffer) { + FreeHistoryItem(arPopupHistory[0]); + arPopupHistory.remove(0); + } + arPopupHistory.insert(ppd); + if (hwndHistory) PostMessage(hwndHistory, UM_ADDITEM, 0, (LPARAM)ppd); } @@ -164,19 +128,17 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA static enum { LOG_NONE, LOG_DEFAULT, LOG_HPP } logType = LOG_NONE; static HWND hwndLog = NULL; - switch (msg) - { - case WM_INITDIALOG: + switch (msg) { + case WM_INITDIALOG: { oldWidth = 0; HWND hwndList = GetDlgItem(hwnd, IDC_POPUP_LIST); - for (int i = 0; i < popupHistorySize; ++i) + 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) - { + if (gbHppInstalled && PopUpOptions.UseHppHistoryLog) { logType = LOG_HPP; ShowWindow(GetDlgItem(hwnd, IDC_POPUP_LIST), SW_HIDE); @@ -185,7 +147,6 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA ieWindow.iType = IEW_CREATE; ieWindow.dwFlags = 0; ieWindow.dwMode = IEWM_MUCC; -// ieWindow.dwMode = IEWM_CHAT; ieWindow.parent = hwnd; ieWindow.x = 0; ieWindow.y = 0; @@ -223,33 +184,32 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA ieEvent.codepage = 0; ieEvent.pszProto = NULL; - for (int i = 0; i < popupHistorySize; ++i) - { + 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 = getHistoryItem(i)->colorText; - if (getHistoryItem(i)->flags & PU2_UNICODE) - { + ieData.color = ppd->colorText; + if (ppd->flags & PU2_UNICODE) { ieData.dwFlags |= IEEDF_UNICODE_TEXT|IEEDF_UNICODE_NICK; - ieData.pszNickW = getHistoryItem(i)->lpwzTitle; - ieData.pszTextW = getHistoryItem(i)->lpwzText; + ieData.pszNickW = ppd->lpwzTitle; + ieData.pszTextW = ppd->lpwzText; ieData.pszText2W = NULL; - } else - { + } + else { ieData.dwFlags |= 0; - ieData.pszNick = getHistoryItem(i)->lpzTitle; - ieData.pszText = getHistoryItem(i)->lpzText; + ieData.pszNick = ppd->lpzTitle; + ieData.pszText = ppd->lpzText; ieData.pszText2 = NULL; } ieData.bIsMe = FALSE; - ieData.time = getHistoryItem(i)->dwTimestamp; + ieData.time = ppd->dwTimestamp; ieData.dwData = 0; ieData.next = NULL; CallService(MS_HPP_EG_EVENT, 0, (WPARAM)&ieEvent); } - } else - { + } + else { logType = LOG_DEFAULT; hwndLog = hwndList; @@ -258,31 +218,24 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA Utils_RestoreWindowPosition(hwnd, NULL, MODULNAME, "popupHistory_"); - if (logType == LOG_DEFAULT) - { + if (logType == LOG_DEFAULT) { SendMessage(hwnd, UM_RESIZELIST, 0, 0); - ListBox_SetTopIndex(hwndLog, popupHistorySize-1); + ListBox_SetTopIndex(hwndLog, arPopupHistory.getCount()-1); } - - return TRUE; } - case WM_MEASUREITEM: - { - if (logType != LOG_DEFAULT) - return TRUE; + return TRUE; - LPMEASUREITEMSTRUCT lpmis; - lpmis = (LPMEASUREITEMSTRUCT) lParam; + case WM_MEASUREITEM: + if (logType == LOG_DEFAULT) { + LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT) lParam; if (lpmis->itemID == -1) return FALSE; lpmis->itemHeight = 50; - return TRUE; } - case WM_DRAWITEM: - { - if (logType != LOG_DEFAULT) - return TRUE; + return TRUE; + case WM_DRAWITEM: + if (logType == LOG_DEFAULT) { LPDRAWITEMSTRUCT lpdis; lpdis = (LPDRAWITEMSTRUCT) lParam; if (lpdis->itemID == -1) @@ -290,9 +243,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA HWND hwndList = GetDlgItem(hwnd, lpdis->CtlID); PopupWnd2 *wndPreview = (PopupWnd2 *)ListBox_GetItemData(hwndList, lpdis->itemID); - - if (!wndPreview) - { + if (!wndPreview) { RECT rc; GetWindowRect(hwndLog, &rc); if (rc.right-rc.left <= 30) @@ -302,7 +253,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA customOptions.DynamicResize = FALSE; customOptions.MinimumWidth = customOptions.MaximumWidth = rc.right-rc.left-30; - POPUPDATA2 *ppd = &popupHistory[getHistoryIndex(lpdis->itemID)]; + POPUPDATA2 *ppd = arPopupHistory[lpdis->itemID]; wndPreview = new PopupWnd2(ppd, &customOptions, true); wndPreview->buildMText(); wndPreview->update(); @@ -311,15 +262,13 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA ListBox_SetItemHeight(hwndLog, lpdis->itemID, wndPreview->getSize().cy+6); } - if (wndPreview) - { - if (lpdis->itemState & ODS_SELECTED) - { + if (wndPreview) { + if (lpdis->itemState & ODS_SELECTED) { HBRUSH hbr = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT)); FillRect(lpdis->hDC, &lpdis->rcItem, hbr); DeleteObject(hbr); - } else - { + } + else { HBRUSH hbr = CreateSolidBrush(GetSysColor(COLOR_WINDOW)); FillRect(lpdis->hDC, &lpdis->rcItem, hbr); DeleteObject(hbr); @@ -328,44 +277,35 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA int width = wndPreview->getContent()->getWidth(); int height = wndPreview->getContent()->getHeight(); - { - BLENDFUNCTION bf; - bf.BlendOp = AC_SRC_OVER; - bf.BlendFlags = 0; - bf.SourceConstantAlpha = 255; - bf.AlphaFormat = AC_SRC_ALPHA; - AlphaBlend(lpdis->hDC, lpdis->rcItem.left+5, lpdis->rcItem.top+3, width, height, - wndPreview->getContent()->getDC(), - 0, 0, width, height, bf); - } - + BLENDFUNCTION bf; + bf.BlendOp = AC_SRC_OVER; + bf.BlendFlags = 0; + bf.SourceConstantAlpha = 255; + bf.AlphaFormat = AC_SRC_ALPHA; + AlphaBlend(lpdis->hDC, lpdis->rcItem.left+5, lpdis->rcItem.top+3, width, height, + wndPreview->getContent()->getDC(), + 0, 0, width, height, bf); } - - return TRUE; } - case WM_DELETEITEM: - { - if (logType != LOG_DEFAULT) - return TRUE; + return TRUE; + case WM_DELETEITEM: + if (logType != LOG_DEFAULT) { DELETEITEMSTRUCT *lpdis = (DELETEITEMSTRUCT *)lParam; PopupWnd2 *wnd = (PopupWnd2 *)ListBox_GetItemData(lpdis->hwndItem, lpdis->itemID); - if (wnd) delete wnd; - return TRUE; + if (wnd) + delete wnd; } - case WM_SIZE: + 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) - { -// POINT pt; -// pt.x = rcLst.left; -// pt.y = rcLst.top; -// ScreenToClient(hwnd, &pt); + 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); @@ -380,121 +320,103 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA 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) - { + } + 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) - { + 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; } - case UM_RESIZELIST: - { - if (logType != LOG_DEFAULT) - return TRUE; - - RECT rc; GetWindowRect(GetDlgItem(hwnd, IDC_POPUP_LIST), &rc); + return TRUE; + case UM_RESIZELIST: + if (logType == LOG_DEFAULT) { + RECT rc; + GetWindowRect(GetDlgItem(hwnd, IDC_POPUP_LIST), &rc); if (rc.right-rc.left <= 30) return FALSE; - for (int i = 0; i < popupHistorySize; ++i) - { + for (int i=0; i < arPopupHistory.getCount(); ++i) { PopupWnd2 *wndPreview = (PopupWnd2 *)ListBox_GetItemData(hwndLog, i); - if (wndPreview) delete wndPreview; + if (wndPreview) + delete wndPreview; ListBox_SetItemData(hwndLog, i, 0); ListBox_SetItemHeight(hwndLog, i, 50); } ScrollWindow(hwndLog, 0, 100000, NULL, NULL); InvalidateRect(hwndLog, NULL, TRUE); - - return TRUE; } - case UM_ADDITEM: - { - if (logType == LOG_HPP) - { - POPUPDATA2 *ppd = (POPUPDATA2 *)lParam; - - 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; - - ieData.cbSize = sizeof(ieData); - ieData.dwFlags = 0; - ieData.iType = IEED_EVENT_SYSTEM; - ieData.color = ppd->colorText; - if (ppd->flags & PU2_UNICODE) - { - ieData.dwFlags |= IEEDF_UNICODE_TEXT|IEEDF_UNICODE_NICK; - ieData.pszNickW = ppd->lpwzTitle; - ieData.pszTextW = ppd->lpwzText; - 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 - if(logType == LOG_DEFAULT) - { - if (popupHistorySize <= ListBox_GetCount(hwndLog)) - { - loadItem = 0; - PostMessage(hwnd, UM_RESIZELIST, 0, 0); - return TRUE; - } - ListBox_SetItemData(hwndLog, ListBox_AddString(hwndLog, _T("")), 0); -/* if (loadItem < 0) - { - loadItem = ListBox_GetCount(hwndList)-1; - SendMessage(hwnd, UM_RESIZEITEM, 0, 0); - }*/ + return TRUE; + + case UM_ADDITEM: + if (logType == LOG_HPP) { + POPUPDATA2 *ppd = (POPUPDATA2 *)lParam; + + 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; + + ieData.cbSize = sizeof(ieData); + ieData.dwFlags = 0; + ieData.iType = IEED_EVENT_SYSTEM; + ieData.color = ppd->colorText; + if (ppd->flags & PU2_UNICODE) { + ieData.dwFlags |= IEEDF_UNICODE_TEXT|IEEDF_UNICODE_NICK; + ieData.pszNickW = ppd->lpwzTitle; + ieData.pszTextW = ppd->lpwzText; + ieData.pszText2W = NULL; } - return TRUE; - } - case WM_CLOSE: - { - Utils_SaveWindowPosition(hwnd, NULL, MODULNAME, "popupHistory_"); - DestroyWindow(hwnd); - hwndHistory = NULL; - return TRUE; + 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); } - case WM_DESTROY: - { - if (logType == LOG_HPP) - { - IEVIEWWINDOW ieWindow; - ieWindow.cbSize = sizeof(IEVIEWWINDOW); - ieWindow.iType = IEW_DESTROY; - ieWindow.dwFlags = 0; - ieWindow.dwMode = IEWM_TABSRMM; - ieWindow.parent = hwnd; - ieWindow.hwnd = hwndLog; - CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow); + else if(logType == LOG_DEFAULT) { + if (arPopupHistory.getCount() <= ListBox_GetCount(hwndLog)) { + loadItem = 0; + PostMessage(hwnd, UM_RESIZELIST, 0, 0); + return TRUE; } + ListBox_SetItemData(hwndLog, ListBox_AddString(hwndLog, _T("")), 0); + } + return TRUE; + + case WM_CLOSE: + Utils_SaveWindowPosition(hwnd, NULL, MODULNAME, "popupHistory_"); + DestroyWindow(hwnd); + hwndHistory = NULL; + return TRUE; + + case WM_DESTROY: + if (logType == LOG_HPP) { + IEVIEWWINDOW ieWindow; + ieWindow.cbSize = sizeof(IEVIEWWINDOW); + ieWindow.iType = IEW_DESTROY; + ieWindow.dwFlags = 0; + ieWindow.dwMode = IEWM_TABSRMM; + ieWindow.parent = hwnd; + ieWindow.hwnd = hwndLog; + CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow); } } return FALSE; //DefWindowProc(hwnd, msg, wParam, lParam); diff --git a/plugins/Popup/src/icons.cpp b/plugins/Popup/src/icons.cpp index e33d39ec83..b92df47a6b 100644 --- a/plugins/Popup/src/icons.cpp +++ b/plugins/Popup/src/icons.cpp @@ -101,7 +101,7 @@ void InitIcons() TCHAR selfDLL[1024]; GetModuleFileName(hInst, selfDLL, 1024); - for(int i = 0; i < SIZEOF(icoDesc); i++) { + for(int i=0; i < SIZEOF(icoDesc); i++) { sid.pszName = icoDesc[i].pszName; sid.ptszDescription = icoDesc[i].ptszDesc; // [TRANSLATED-BY-CORE] sid.ptszSection = icoDesc[i].ptszSection; //must be always untranslatet !!!!! diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index bed6cdc116..c52ff490d2 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -82,7 +82,7 @@ void LoadNotifications() void UnloadTreeData() { - for (int i = 0; i < gTreeData.getCount(); ++i) { + for (int i=0; i < gTreeData.getCount(); ++i) { if(gTreeData[i]->typ == 2) { mir_free(gTreeData[i]->pupClass.pszName); mir_free(gTreeData[i]->pupClass.pszDescription); @@ -128,7 +128,7 @@ void SaveNotificationSettings(POPUPTREEDATA *ptd, char* szModul) ptd->notification.lpzName); DBWriteContactSettingString(NULL, szModul, setting, ptd->rightAction); - for (int i = 0; i < ptd->notification.actionCount; ++i) + for (int i=0; i < ptd->notification.actionCount; ++i) { if (!lstrcmpA(ptd->leftAction, ptd->notification.lpActions[i].lpzTitle)) { @@ -243,7 +243,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) HANDLE FindTreeData(LPTSTR group, LPTSTR name, BYTE typ) { - for(int i = 0; i < gTreeData.getCount(); i++) { + for(int i=0; i < gTreeData.getCount(); i++) { if ( gTreeData[i]->typ == typ && (!group || (_tcscmp(gTreeData[i]->pszTreeRoot, group) == 0)) && (!name || (_tcscmp(gTreeData[i]->pszDescription, name) == 0))) @@ -333,7 +333,7 @@ bool PerformAction(HANDLE hNotification, HWND hwnd, UINT message, WPARAM wparam, return true; } - for (int i = 0; i < ptd->notification.actionCount; ++i) + for (int i=0; i < ptd->notification.actionCount; ++i) { if (!(ptd->notification.lpActions[i].dwFlags&PNAF_CALLBACK)) continue; diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index 2bd5ab39b9..dcad8555f7 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -44,7 +44,7 @@ void OptAdv_RegisterVfx(char *name) { } void OptAdv_UnregisterVfx() { - for (int i = 0; i < g_lstPopupVfx.getCount(); ++i) + for (int i=0; i < g_lstPopupVfx.getCount(); ++i) mir_free(g_lstPopupVfx[i]); g_lstPopupVfx.destroy(); } @@ -217,7 +217,7 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("No effect")) ,-2); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Fade in/out")) ,-1); dwActiveItem = (DWORD)PopUpOptions.UseEffect; - for (int i = 0; i < g_lstPopupVfx.getCount(); ++i) { + for (int i=0; i < g_lstPopupVfx.getCount(); ++i) { dwItem = ComboBox_AddString(hCtrl, TranslateTS(g_lstPopupVfx[i])); ComboBox_SetItemData(hCtrl, dwItem, i); if (PopUpOptions.UseEffect && !lstrcmp(g_lstPopupVfx[i], PopUpOptions.Effect)) diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index 82d71b288a..af038bce55 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -36,7 +36,7 @@ Last change by : $Author: Merlin_de $ //--------------------------------------------------------------------------- //Workaround for MS bug ComboBox_SelectItemData int ComboBox_SelectItem(HWND hwndCtl, int indexStart, char* data) { - int i = 0; + int i=0; for ( i ; i < ComboBox_GetCount(hwndCtl); i++) { if(strcmp(data, (char*)ComboBox_GetItemData(hwndCtl, i))==0) { ComboBox_SetCurSel (hwndCtl,i); @@ -339,7 +339,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l } //end if (tvi.lParam) else { //enable / disable controls - for (int i = 0; i < SIZEOF(ctrlsAll); ++i) { + for (int i=0; i < SIZEOF(ctrlsAll); ++i) { ShowWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp0 ? SW_SHOW : SW_HIDE); EnableWindow(GetDlgItem(hwnd, ctrlsAll[i].idCtrl), ctrlsAll[i].onTyp0); } @@ -489,7 +489,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l switch (((LPNMHDR)lParam)->code) { case PSN_RESET: { - for(int i = 0; i < gTreeData.getCount(); ++i) { + for(int i=0; i < gTreeData.getCount(); ++i) { switch (gTreeData[i]->typ) { case 1: LoadNotificationSettings(gTreeData[i], "PopUpNotifications"); @@ -506,7 +506,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l } case PSN_APPLY: { - for(int i = 0; i < gTreeData.getCount(); ++i) { + for(int i=0; i < gTreeData.getCount(); ++i) { switch (gTreeData[i]->typ) { case 1: gTreeData[i]->notification.iSeconds = gTreeData[i]->timeoutValue; diff --git a/plugins/Popup/src/opt_contacts.cpp b/plugins/Popup/src/opt_contacts.cpp index 3aaf0b3520..c7a1187717 100644 --- a/plugins/Popup/src/opt_contacts.cpp +++ b/plugins/Popup/src/opt_contacts.cpp @@ -93,7 +93,7 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l iImage=SendDlgItemMessage(hwnd,IDC_LIST,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(nm->iColumn,0)); if (iImage != 0xFF) { - for (int i = 0; i < 4 /*SIZEOF(sttIcons)*/; ++i) + for (int i=0; i < 4 /*SIZEOF(sttIcons)*/; ++i) //hIml element [0] = SKINICON_OTHER_SMALLDOT //hIml element [1..5] = IcoLib_GetIcon(....) ~ old sttIcons SendDlgItemMessage(hwnd, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, (i==nm->iColumn)?i+1:0)); @@ -102,7 +102,7 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l { while (hItem=(HANDLE)SendDlgItemMessage(hwnd,IDC_LIST,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hItem)) { - for (int i = 0; i < SIZEOF(sttIcons); ++i) + for (int i=0; i < SIZEOF(sttIcons); ++i) SendDlgItemMessage(hwnd, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, (i==nm->iColumn)?i+1:0)); hItem = (HANDLE)SendDlgItemMessage(hwnd,IDC_LIST,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hItem); } @@ -126,7 +126,7 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l hContact=db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); - for (int i = 0; i < 4 /*SIZEOF(sttIcons)*/; ++i) + for (int i=0; i < 4 /*SIZEOF(sttIcons)*/; ++i) { if (SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(i,0))) { @@ -167,7 +167,7 @@ static void sttSetAllContactIcons(HWND hwndList) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); DWORD dwMode = DBGetContactSettingByte(hContact, MODULNAME, "ShowMode", 0); - for (int i = 0; i < 4 /*SIZEOF(sttIcons)*/; ++i) + for (int i=0; i < 4 /*SIZEOF(sttIcons)*/; ++i) //hIml element [0] = SKINICON_OTHER_SMALLDOT //hIml element [1..5] = IcoLib_GetIcon(....) ~ old sttIcons SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, (dwMode==i)?i+1:0)); diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index de54c568cf..39f756b606 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -347,7 +347,7 @@ INT_PTR CALLBACK DlgProcPopUpGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE)|WS_EX_LAYERED); SetLayeredWindowAttributes(hwndBox, NULL, 0, LWA_ALPHA); ShowWindow(hwndBox, SW_SHOW); - for (int i = 0; i <= 255; i += 15) { + for (int i=0; i <= 255; i += 15) { SetLayeredWindowAttributes(hwndBox, NULL, i, LWA_ALPHA); UpdateWindow(hwndBox); Sleep(1); @@ -559,7 +559,7 @@ INT_PTR CALLBACK DlgProcPopUpGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM char prefix[128]; LPTSTR pszSettingName = NULL; - for (int i = 0; i < protocolCount; ++i) + for (int i=0; i < protocolCount; ++i) { mir_snprintf(prefix, sizeof(prefix), "Protocol Status/%s", protocols[i]->szModuleName); pszSettingName = mir_a2t(prefix); @@ -609,7 +609,7 @@ INT_PTR CALLBACK DlgProcPopUpGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case WM_DESTROY: { if (statusOptions) { - for (int i = 0; i < statusOptionsCount; ++i) { + for (int i=0; i < statusOptionsCount; ++i) { mir_free(statusOptions[i].pszOptionName); mir_free(statusOptions[i].pszSettingName); } diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index 78fe66e68e..a6083564cc 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -224,7 +224,7 @@ int SkinOptionList_AddMain(OPTTREE_OPTION* &options, int *OptionsCount, int pos LPGENT("Enable Aero Glass (Vista+)"), LPGENT("Use Windows colours"), LPGENT("Use advanced text render")}; - for (int i = 0; i < SIZEOF(mainOption); i++) { + for (int i=0; i < SIZEOF(mainOption); i++) { bCheck = 0; switch (i) { case 0: @@ -278,7 +278,7 @@ bool SkinOptionList_Update (OPTTREE_OPTION* &options, int *OptionsCount, HWND hw if (options) { int index = -1; OptTree_ProcessMessage(hwndDlg, WM_DESTROY, 0, 0, &index, IDC_SKIN_LIST_OPT, options, *OptionsCount); - for (int i = 0; i < *OptionsCount; ++i) { + for (int i=0; i < *OptionsCount; ++i) { mir_free(options[i].pszOptionName); mir_free(options[i].pszSettingName); } @@ -547,7 +547,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } if (hhkFontsReload) UnhookEvent(hhkFontsReload); if (skinOptions) { - for (int i = 0; i < skinOptionsCount; ++i) { + for (int i=0; i < skinOptionsCount; ++i) { mir_free(skinOptions[i].pszOptionName); mir_free(skinOptions[i].pszSettingName); } diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index 134e10ba22..d74857dffd 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -220,7 +220,7 @@ void RepositionPopups() PopupWnd2 *prev = 0; if (PopUpOptions.ReorderPopUps) { - for (int i = 0; i < popupList.getCount(); ++i) + for (int i=0; i < popupList.getCount(); ++i) { UpdatePopupPosition(prev, popupList[i]); prev = popupList[i]; @@ -245,7 +245,7 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA { gTerminating = true; if (DBGetContactSettingByte(NULL, MODULNAME, "FastExit", 0)) - for (int i = 0; i < popupList.getCount(); ++i) + for (int i=0; i < popupList.getCount(); ++i) PUDeletePopUp(popupList[i]->getHwnd()); PostQuitMessage(0); break; @@ -278,7 +278,7 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA case UTM_REMOVE_WINDOW: { // popupList.remove(ptr) would be nicer, but it requires sortFunc :( - for (int i = 0; i < popupList.getCount(); ++i) + for (int i=0; i < popupList.getCount(); ++i) if (popupList[i] == wnd) { popupList.remove(i); diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 6b9755f532..74ff137c79 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -369,7 +369,7 @@ void PopupWnd2::animate() } // update tooltips - for (int i = 0; i < m_actionCount; ++i) + for (int i=0; i < m_actionCount; ++i) { char *title = strchr(m_actions[i].actionA.lpzTitle, '/'); if (title) title++; @@ -1360,7 +1360,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara case UM_POPUPMODIFYACTIONICON: { LPPOPUPACTIONID actionId = (LPPOPUPACTIONID)wParam; - for (int i = 0; i < m_actionCount; ++i) + for (int i=0; i < m_actionCount; ++i) if ((m_actions[i].actionA.wParam == actionId->wParam) && (m_actions[i].actionA.lParam == actionId->lParam)) { diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index 6d35cf3db7..d0c98c9903 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -531,7 +531,7 @@ INT_PTR PopUp_Query(WPARAM wParam, LPARAM lParam) INT_PTR PopUp_RegisterActions(WPARAM wParam, LPARAM lParam) { LPPOPUPACTION actions = (LPPOPUPACTION)wParam; - for (int i = 0; i < lParam; ++i) + for (int i=0; i < lParam; ++i) RegisterAction(&actions[i]); return 0; } diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index 509d98c908..ee6846bab4 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -39,7 +39,7 @@ Last change by : $Author: Merlin_de $ // PopupSkin PopupSkin::PopupSkin(LPCTSTR aName) { - for (int i = 0; i < 32; i++) + for (int i=0; i < 32; i++) m_flag_names[i] = NULL; m_elements = 0; m_name = aName ? mir_tstrdup(aName) : NULL; @@ -48,7 +48,7 @@ PopupSkin::PopupSkin(LPCTSTR aName) PopupSkin::~PopupSkin() { if (m_name) mir_free(m_name); - for (int i = 0; i < 32; i++) + for (int i=0; i < 32; i++) mir_free(m_flag_names[i]); freeSkin(m_elements); } @@ -99,7 +99,7 @@ SIZE PopupSkin::measureActionBar(HDC hdc, PopupWnd2 *wnd) const { SIZE sz = {0}; HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.action); - for (int i = 0; i < wnd->getActionCount(); ++i) + for (int i=0; i < wnd->getActionCount(); ++i) { SIZE szAction = measureAction(hdc, &wnd->getActions()[i].actionA); @@ -175,7 +175,7 @@ void PopupSkin::drawAction(MyBitmap *bmp, POPUPACTION *act, int x, int y, bool h void PopupSkin::drawActionBar(MyBitmap *bmp, PopupWnd2 *wnd, int x, int y) const { - for (int i = 0; i < wnd->getActionCount(); ++i) + for (int i=0; i < wnd->getActionCount(); ++i) { SIZE szAction = measureAction(bmp->getDC(), &wnd->getActions()[i].actionA); drawAction(bmp, &wnd->getActions()[i].actionA, x, y, wnd->getActions()[i].hover); @@ -240,7 +240,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options wnd->getArgs()->add("window.width", maxw); wnd->getArgs()->add("window.maxwidth", maxw); - for (int i = 0; i < 32; ++i) + for (int i=0; i < 32; ++i) { char buf[10]; wsprintfA(buf, "opt%d", i); @@ -877,7 +877,7 @@ bool PopupSkin::onMouseMove(PopupWnd2 *wnd, int x, int y) const bool res = false; bool hovered = false; - for (int i = 0; i < wnd->getActionCount(); ++i) + for (int i=0; i < wnd->getActionCount(); ++i) { bool hover = PtInRect(&wnd->getActions()[i].rc, pt) ? true : false; hovered |= hover; @@ -897,7 +897,7 @@ bool PopupSkin::onMouseLeave(PopupWnd2 *wnd) const { bool res = false; - for (int i = 0; i < wnd->getActionCount(); ++i) + for (int i=0; i < wnd->getActionCount(); ++i) { if (wnd->getActions()[i].hover) { @@ -952,7 +952,7 @@ void PopupSkin::loadOptions(std::istream &f) bool PopupSkin::load(LPCTSTR dir) { - for (int i = 0; i < 32; i++) + for (int i=0; i < 32; i++) { if (m_flag_names[i]) { diff --git a/plugins/Popup/src/srmm_menu.cpp b/plugins/Popup/src/srmm_menu.cpp index 005cdf5765..ee91a5fd35 100644 --- a/plugins/Popup/src/srmm_menu.cpp +++ b/plugins/Popup/src/srmm_menu.cpp @@ -103,7 +103,7 @@ static void SrmmMenu_UpdateIcon(HANDLE hContact) sid.cbSize = sizeof(sid); sid.szModule = MODULNAME; - for (int i = 0; i < 4; ++i) + for (int i=0; i < 4; ++i) { sid.dwId = i; sid.flags = (i == mode) ? 0 : MBF_HIDDEN; -- cgit v1.2.3