diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-05 22:41:06 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-05 22:41:06 +0000 |
commit | e3cefc7b6ca803e3f87dbadae54a110332778490 (patch) | |
tree | 0ee41f14f962f946c9e64fae4a11fbcb197af853 /src/modules/utils | |
parent | f0fb070eab8f276e66c0154363656045bc0dadb3 (diff) |
- first of the /Core standard plugins;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@778 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/utils')
-rw-r--r-- | src/modules/utils/bmpfilter.cpp | 72 | ||||
-rw-r--r-- | src/modules/utils/colourpicker.cpp | 44 | ||||
-rw-r--r-- | src/modules/utils/hyperlink.cpp | 106 | ||||
-rw-r--r-- | src/modules/utils/imgconv.cpp | 2 | ||||
-rw-r--r-- | src/modules/utils/path.cpp | 4 | ||||
-rw-r--r-- | src/modules/utils/resizer.cpp | 52 | ||||
-rw-r--r-- | src/modules/utils/timeutils.cpp | 2 | ||||
-rw-r--r-- | src/modules/utils/timezones.cpp | 34 | ||||
-rw-r--r-- | src/modules/utils/utils.cpp | 26 | ||||
-rw-r--r-- | src/modules/utils/windowlist.cpp | 18 |
10 files changed, 180 insertions, 180 deletions
diff --git a/src/modules/utils/bmpfilter.cpp b/src/modules/utils/bmpfilter.cpp index 46db86baaf..442c75996a 100644 --- a/src/modules/utils/bmpfilter.cpp +++ b/src/modules/utils/bmpfilter.cpp @@ -106,12 +106,12 @@ static INT_PTR sttBitmapLoader(const TCHAR* ptszFileName) GetObject(hBmp, sizeof(bmpInfo), &bmpInfo);
//need to copy bitmap so we can free the IPicture
- hdc=GetDC(NULL);
- hdcMem1=CreateCompatibleDC(hdc);
- hdcMem2=CreateCompatibleDC(hdc);
- hOldBitmap=(HBITMAP)SelectObject(hdcMem1, hBmp);
- hBmpCopy=CreateCompatibleBitmap(hdcMem1, bmpInfo.bmWidth, bmpInfo.bmHeight);
- hOldBitmap2=(HBITMAP)SelectObject(hdcMem2, hBmpCopy);
+ hdc = GetDC(NULL);
+ hdcMem1 = CreateCompatibleDC(hdc);
+ hdcMem2 = CreateCompatibleDC(hdc);
+ hOldBitmap = (HBITMAP)SelectObject(hdcMem1, hBmp);
+ hBmpCopy = CreateCompatibleBitmap(hdcMem1, bmpInfo.bmWidth, bmpInfo.bmHeight);
+ hOldBitmap2 = (HBITMAP)SelectObject(hdcMem2, hBmpCopy);
BitBlt(hdcMem2, 0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, hdcMem1, 0, 0, SRCCOPY);
SelectObject(hdcMem1, hOldBitmap);
SelectObject(hdcMem2, hOldBitmap2);
@@ -138,91 +138,91 @@ static INT_PTR BmpFilterLoadBitmapW(WPARAM, LPARAM lParam) static INT_PTR BmpFilterGetStrings(WPARAM wParam, LPARAM lParam)
{
- int bytesLeft=wParam;
- char *filter=(char*)lParam, *pfilter;
+ int bytesLeft = wParam;
+ char *filter = (char*)lParam, *pfilter;
lstrcpynA(filter, Translate("All Bitmaps"), bytesLeft); bytesLeft-=lstrlenA(filter);
strncat(filter, " (*.bmp;*.jpg;*.gif;*.png)", bytesLeft);
- pfilter=filter+lstrlenA(filter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter = filter+lstrlenA(filter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpynA(pfilter, "*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG", bytesLeft);
- pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpynA(pfilter, Translate("Windows Bitmaps"), bytesLeft); bytesLeft-=lstrlenA(pfilter);
strncat(pfilter, " (*.bmp;*.rle)", bytesLeft);
- pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpynA(pfilter, "*.BMP;*.RLE", bytesLeft);
- pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpynA(pfilter, Translate("JPEG Bitmaps"), bytesLeft); bytesLeft-=lstrlenA(pfilter);
strncat(pfilter, " (*.jpg;*.jpeg)", bytesLeft);
- pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpynA(pfilter, "*.JPG;*.JPEG", bytesLeft);
- pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpynA(pfilter, Translate("GIF Bitmaps"), bytesLeft); bytesLeft-=lstrlenA(pfilter);
strncat(pfilter, " (*.gif)", bytesLeft);
- pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpynA(pfilter, "*.GIF", bytesLeft);
- pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpynA(pfilter, Translate("PNG Bitmaps"), bytesLeft); bytesLeft-=lstrlenA(pfilter);
strncat(pfilter, " (*.png)", bytesLeft);
- pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpynA(pfilter, "*.PNG", bytesLeft);
- pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpynA(pfilter, Translate("All Files"), bytesLeft); bytesLeft-=lstrlenA(pfilter);
strncat(pfilter, " (*)", bytesLeft);
- pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpynA(pfilter, "*", bytesLeft);
- pfilter+=lstrlenA(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
- if (bytesLeft) *pfilter='\0';
+ if (bytesLeft) *pfilter = '\0';
return 0;
}
static INT_PTR BmpFilterGetStringsW(WPARAM wParam, LPARAM lParam)
{
- int bytesLeft=wParam;
- TCHAR *filter=(TCHAR*)lParam, *pfilter;
+ int bytesLeft = wParam;
+ TCHAR *filter = (TCHAR*)lParam, *pfilter;
lstrcpyn(filter, TranslateT("All Bitmaps"), bytesLeft); bytesLeft-=lstrlen(filter);
_tcsncat(filter, _T(" (*.bmp;*.jpg;*.gif;*.png)"), bytesLeft);
- pfilter=filter+lstrlen(filter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter = filter+lstrlen(filter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpyn(pfilter, _T("*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG"), bytesLeft);
- pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpyn(pfilter, TranslateT("Windows Bitmaps"), bytesLeft); bytesLeft-=lstrlen(pfilter);
_tcsncat(pfilter, _T(" (*.bmp;*.rle)"), bytesLeft);
- pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpyn(pfilter, _T("*.BMP;*.RLE"), bytesLeft);
- pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpyn(pfilter, TranslateT("JPEG Bitmaps"), bytesLeft); bytesLeft-=lstrlen(pfilter);
_tcsncat(pfilter, _T(" (*.jpg;*.jpeg)"), bytesLeft);
- pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpyn(pfilter, _T("*.JPG;*.JPEG"), bytesLeft);
- pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpyn(pfilter, TranslateT("GIF Bitmaps"), bytesLeft); bytesLeft-=lstrlen(pfilter);
_tcsncat(pfilter, _T(" (*.gif)"), bytesLeft);
- pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpyn(pfilter, _T("*.GIF"), bytesLeft);
- pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpyn(pfilter, TranslateT("PNG Bitmaps"), bytesLeft); bytesLeft-=lstrlen(pfilter);
_tcsncat(pfilter, _T(" (*.png)"), bytesLeft);
- pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpyn(pfilter, _T("*.PNG"), bytesLeft);
- pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpyn(pfilter, TranslateT("All Files"), bytesLeft); bytesLeft-=lstrlen(pfilter);
_tcsncat(pfilter, _T(" (*)"), bytesLeft);
- pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
lstrcpyn(pfilter, _T("*"), bytesLeft);
- pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
+ pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
- if (bytesLeft) *pfilter='\0';
+ if (bytesLeft) *pfilter = '\0';
return 0;
}
diff --git a/src/modules/utils/colourpicker.cpp b/src/modules/utils/colourpicker.cpp index dd31bf7155..badfcb712e 100644 --- a/src/modules/utils/colourpicker.cpp +++ b/src/modules/utils/colourpicker.cpp @@ -42,15 +42,15 @@ static LRESULT CALLBACK ColourPickerWndProc(HWND hwnd, UINT message, WPARAM wPar return GetWindowLongPtr(hwnd, 0);
case WM_LBUTTONUP:
{
- CHOOSECOLOR cc={0};
- COLORREF custColours[16]={0};
- custColours[0]=GetWindowLongPtr(hwnd, sizeof(COLORREF));
- cc.lStructSize=sizeof(CHOOSECOLOR);
- cc.hwndOwner=hwnd;
- cc.hInstance=(HWND)hInst;
- cc.rgbResult=GetWindowLongPtr(hwnd, 0);
- cc.lpCustColors=custColours;
- cc.Flags=CC_ANYCOLOR|CC_FULLOPEN|CC_RGBINIT;
+ CHOOSECOLOR cc = {0};
+ COLORREF custColours[16] = {0};
+ custColours[0] = GetWindowLongPtr(hwnd, sizeof(COLORREF));
+ cc.lStructSize = sizeof(CHOOSECOLOR);
+ cc.hwndOwner = hwnd;
+ cc.hInstance = (HWND)hInst;
+ cc.rgbResult = GetWindowLongPtr(hwnd, 0);
+ cc.lpCustColors = custColours;
+ cc.Flags = CC_ANYCOLOR|CC_FULLOPEN|CC_RGBINIT;
if (ChooseColor(&cc)) {
SetWindowLongPtr(hwnd, 0, cc.rgbResult);
SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), CPN_COLOURCHANGED), (LPARAM)hwnd);
@@ -68,14 +68,14 @@ static LRESULT CALLBACK ColourPickerWndProc(HWND hwnd, UINT message, WPARAM wPar RECT rc;
HBRUSH hBrush;
- hdc1=BeginPaint(hwnd, &ps);
+ hdc1 = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rc);
DrawEdge(hdc1, &rc, EDGE_ETCHED, BF_RECT);
InflateRect(&rc, -2, -2);
if (IsWindowEnabled(hwnd))
- hBrush=CreateSolidBrush(GetWindowLongPtr(hwnd, 0));
+ hBrush = CreateSolidBrush(GetWindowLongPtr(hwnd, 0));
else
- hBrush=CreateHatchBrush(HS_BDIAGONAL, GetSysColor(COLOR_GRAYTEXT));
+ hBrush = CreateHatchBrush(HS_BDIAGONAL, GetSysColor(COLOR_GRAYTEXT));
SetBkColor(hdc1, GetSysColor(COLOR_BTNFACE));
FillRect(hdc1, &rc, hBrush);
DeleteObject(hBrush);
@@ -92,16 +92,16 @@ int InitColourPicker(void) {
WNDCLASS wcl;
- wcl.lpfnWndProc=ColourPickerWndProc;
- wcl.cbClsExtra=0;
- wcl.cbWndExtra=sizeof(COLORREF)*2;
- wcl.hInstance=hInst;
- wcl.hCursor=NULL;
- wcl.lpszClassName=WNDCLASS_COLOURPICKER;
- wcl.hbrBackground=(HBRUSH)(COLOR_BTNFACE+1);
- wcl.hIcon=NULL;
- wcl.lpszMenuName=NULL;
- wcl.style=CS_HREDRAW|CS_VREDRAW|CS_GLOBALCLASS;
+ wcl.lpfnWndProc = ColourPickerWndProc;
+ wcl.cbClsExtra = 0;
+ wcl.cbWndExtra = sizeof(COLORREF)*2;
+ wcl.hInstance = hInst;
+ wcl.hCursor = NULL;
+ wcl.lpszClassName = WNDCLASS_COLOURPICKER;
+ wcl.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
+ wcl.hIcon = NULL;
+ wcl.lpszMenuName = NULL;
+ wcl.style = CS_HREDRAW|CS_VREDRAW|CS_GLOBALCLASS;
RegisterClass(&wcl);
return 0;
}
diff --git a/src/modules/utils/hyperlink.cpp b/src/modules/utils/hyperlink.cpp index ae372a9017..dceff9dd11 100644 --- a/src/modules/utils/hyperlink.cpp +++ b/src/modules/utils/hyperlink.cpp @@ -39,21 +39,21 @@ struct HyperlinkWndData { static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct HyperlinkWndData *dat=(struct HyperlinkWndData*)GetWindowLongPtr(hwnd, 0);
+ struct HyperlinkWndData *dat = (struct HyperlinkWndData*)GetWindowLongPtr(hwnd, 0);
switch(msg) {
case WM_NCCREATE:
- dat=(struct HyperlinkWndData*)mir_calloc(sizeof(struct HyperlinkWndData));
+ dat = (struct HyperlinkWndData*)mir_calloc(sizeof(struct HyperlinkWndData));
if (dat == NULL) return FALSE; /* fail creation */
SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat); /* always succeeds */
/* fall thru */
case WM_SYSCOLORCHANGE:
if ( !(dat->flags&HLKF_HASENABLECOLOR)) {
- if (GetSysColorBrush(COLOR_HOTLIGHT) == NULL) dat->enableColor=RGB(0, 0, 255);
- else dat->enableColor=GetSysColor(COLOR_HOTLIGHT);
+ if (GetSysColorBrush(COLOR_HOTLIGHT) == NULL) dat->enableColor = RGB(0, 0, 255);
+ else dat->enableColor = GetSysColor(COLOR_HOTLIGHT);
dat->focusColor = RGB(GetRValue(dat->enableColor) / 2, GetGValue(dat->enableColor) / 2, GetBValue(dat->enableColor) / 2);
}
if ( !(dat->flags&HLKF_HASDISABLECOLOR))
- dat->disableColor=GetSysColor(COLOR_GRAYTEXT);
+ dat->disableColor = GetSysColor(COLOR_GRAYTEXT);
break;
case WM_SETFOCUS:
@@ -109,15 +109,15 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA { LOGFONT lf;
HFONT hFont;
if ((HFONT)wParam == NULL) { /* use default system color */
- dat->hEnableFont=dat->hDisableFont=NULL;
+ dat->hEnableFont = dat->hDisableFont = NULL;
return 0;
}
if (GetObject((HFONT)wParam, sizeof(lf), &lf)) {
- lf.lfUnderline=1;
- hFont=CreateFontIndirect(&lf);
+ lf.lfUnderline = 1;
+ hFont = CreateFontIndirect(&lf);
if (hFont != NULL) {
- dat->hEnableFont=hFont;
- dat->hDisableFont=(HFONT)wParam;
+ dat->hEnableFont = hFont;
+ dat->hDisableFont = (HFONT)wParam;
if (LOWORD(lParam)) SendMessage(hwnd, HLK_INVALIDATE, 0, 0);
SendMessage(hwnd, HLK_MEASURETEXT, 0, 0);
}
@@ -132,15 +132,15 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA POINT pt;
HWND hwndParent;
if ( !GetWindowRect(hwnd, &rcWnd)) break;
- pt.x=rcWnd.left;
- pt.y=rcWnd.top;
- hwndParent=GetParent(hwnd);
- if (hwndParent == NULL) hwndParent=hwnd;
+ pt.x = rcWnd.left;
+ pt.y = rcWnd.top;
+ hwndParent = GetParent(hwnd);
+ if (hwndParent == NULL) hwndParent = hwnd;
if ( !ScreenToClient(hwndParent, &pt)) break;
- rcWnd.right=pt.x+(rcWnd.right-rcWnd.left);
- rcWnd.bottom=pt.y+(rcWnd.bottom-rcWnd.top);
- rcWnd.left=pt.x;
- rcWnd.top=pt.y;
+ rcWnd.right = pt.x+(rcWnd.right-rcWnd.left);
+ rcWnd.bottom = pt.y+(rcWnd.bottom-rcWnd.top);
+ rcWnd.left = pt.x;
+ rcWnd.top = pt.y;
InvalidateRect(hwndParent, &rcWnd, TRUE);
return 0;
}
@@ -150,7 +150,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA case HLK_MEASURETEXT:
{ TCHAR szText[256];
if ( !GetWindowText(hwnd, szText, SIZEOF(szText))) return 0;
- lParam=(LPARAM)szText;
+ lParam = (LPARAM)szText;
/* fall thru */
case WM_SETTEXT:
{ HFONT hPrevFont = NULL;
@@ -158,21 +158,21 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA RECT rc;
HDC hdc;
LONG style;
- BOOL fMeasured=FALSE;
- hdc=GetDC(hwnd);
+ BOOL fMeasured = FALSE;
+ hdc = GetDC(hwnd);
if (hdc == NULL) return 0; /* text change failed */
- if (dat->hEnableFont != NULL) hPrevFont=(HFONT)SelectObject(hdc, dat->hEnableFont);
+ if (dat->hEnableFont != NULL) hPrevFont = (HFONT)SelectObject(hdc, dat->hEnableFont);
if (dat->hEnableFont == NULL || hPrevFont != NULL) /* select failed? */
if (GetTextExtentPoint32(hdc, (TCHAR*)lParam, lstrlen((TCHAR*)lParam), &textSize))
if (GetClientRect(hwnd, &rc)) {
- dat->rcText.top=0;
- dat->rcText.bottom=dat->rcText.top+textSize.cy;
- style=GetWindowLongPtr(hwnd, GWL_STYLE);
- if (style&SS_CENTER) dat->rcText.left=(rc.right-textSize.cx)/2;
- else if (style&SS_RIGHT) dat->rcText.left=rc.right-textSize.cx;
- else dat->rcText.left=0;
- dat->rcText.right=dat->rcText.left+textSize.cx;
- fMeasured=TRUE;
+ dat->rcText.top = 0;
+ dat->rcText.bottom = dat->rcText.top+textSize.cy;
+ style = GetWindowLongPtr(hwnd, GWL_STYLE);
+ if (style&SS_CENTER) dat->rcText.left = (rc.right-textSize.cx)/2;
+ else if (style&SS_RIGHT) dat->rcText.left = rc.right-textSize.cx;
+ else dat->rcText.left = 0;
+ dat->rcText.right = dat->rcText.left+textSize.cx;
+ fMeasured = TRUE;
}
if (dat->hEnableFont != NULL && hPrevFont != NULL) SelectObject(hdc, hPrevFont);
ReleaseDC(hwnd, hdc);
@@ -186,23 +186,23 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA if ( !GetCursorPos(&pt)) return FALSE;
if ( !ScreenToClient(hwnd, &pt)) return FALSE;
if (PtInRect(&dat->rcText, pt)) {
- hCursor=(HCURSOR)GetClassLongPtr(hwnd, GCLP_HCURSOR);
- if (hCursor == NULL) hCursor=LoadCursor(NULL, IDC_HAND); /* Win2000+ */
+ hCursor = (HCURSOR)GetClassLongPtr(hwnd, GCLP_HCURSOR);
+ if (hCursor == NULL) hCursor = LoadCursor(NULL, IDC_HAND); /* Win2000+ */
}
- else hCursor=LoadCursor(NULL, IDC_ARROW);
+ else hCursor = LoadCursor(NULL, IDC_ARROW);
SetCursor(hCursor);
return TRUE;
}
case HLK_SETENABLECOLOUR:
- { COLORREF prevColor=dat->enableColor;
- dat->enableColor=(COLORREF)wParam;
+ { COLORREF prevColor = dat->enableColor;
+ dat->enableColor = (COLORREF)wParam;
dat->focusColor = RGB(GetRValue(dat->enableColor) / 2, GetGValue(dat->enableColor) / 2, GetBValue(dat->enableColor) / 2);
dat->flags|=HLKF_HASENABLECOLOR;
return (LRESULT)prevColor;
}
case HLK_SETDISABLECOLOUR:
- { COLORREF prevColor=dat->disableColor;
- dat->disableColor=(COLORREF)wParam;
+ { COLORREF prevColor = dat->disableColor;
+ dat->disableColor = (COLORREF)wParam;
dat->flags|=HLKF_HASDISABLECOLOR;
return (LRESULT)prevColor;
}
@@ -217,14 +217,14 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA PAINTSTRUCT ps;
HDC hdc;
- hdc=BeginPaint(hwnd, &ps);
+ hdc = BeginPaint(hwnd, &ps);
if (hdc != NULL) {
if (IsWindowEnabled(hwnd)) {
- hPrevFont=(HFONT)SelectObject(hdc, dat->hEnableFont);
+ hPrevFont = (HFONT)SelectObject(hdc, dat->hEnableFont);
textColor = (GetFocus() == hwnd) ? dat->focusColor : dat->enableColor;
} else {
- hPrevFont=(HFONT)SelectObject(hdc, dat->hDisableFont);
- textColor=dat->disableColor;
+ hPrevFont = (HFONT)SelectObject(hdc, dat->hDisableFont);
+ textColor = dat->disableColor;
}
if (GetClientRect(hwnd, &rc) && GetWindowText(hwnd, szText, SIZEOF(szText))) {
if (drawThemeParentBackground && IsWinVerXPPlus())
@@ -238,7 +238,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA }
SetBkMode(hdc, TRANSPARENT);
SetTextColor(hdc, textColor);
- alignFlag=(GetWindowLongPtr(hwnd, GWL_STYLE)&(SS_CENTER|SS_RIGHT|SS_LEFT));
+ alignFlag = (GetWindowLongPtr(hwnd, GWL_STYLE)&(SS_CENTER|SS_RIGHT|SS_LEFT));
DrawText(hdc, szText, -1, &rc, alignFlag|DT_NOPREFIX|DT_SINGLELINE|DT_TOP);
}
if (hPrevFont != NULL) SelectObject(hdc, hPrevFont);
@@ -258,17 +258,17 @@ int InitHyperlink(void) {
WNDCLASS wcl;
- wcl.lpfnWndProc=HyperlinkWndProc;
- wcl.cbClsExtra=0;
- wcl.cbWndExtra=sizeof(struct HyperlinkWndData*);
- wcl.hInstance=hInst;
- if (IsWinVer2000Plus()) wcl.hCursor=NULL;
- else wcl.hCursor=LoadCursor(wcl.hInstance, MAKEINTRESOURCE(IDC_HYPERLINKHAND));
- wcl.lpszClassName=WNDCLASS_HYPERLINK;
- wcl.hbrBackground=NULL;
- wcl.hIcon=NULL;
- wcl.lpszMenuName=NULL;
- wcl.style=CS_HREDRAW|CS_VREDRAW|CS_GLOBALCLASS|CS_PARENTDC;
+ wcl.lpfnWndProc = HyperlinkWndProc;
+ wcl.cbClsExtra = 0;
+ wcl.cbWndExtra = sizeof(struct HyperlinkWndData*);
+ wcl.hInstance = hInst;
+ if (IsWinVer2000Plus()) wcl.hCursor = NULL;
+ else wcl.hCursor = LoadCursor(wcl.hInstance, MAKEINTRESOURCE(IDC_HYPERLINKHAND));
+ wcl.lpszClassName = WNDCLASS_HYPERLINK;
+ wcl.hbrBackground = NULL;
+ wcl.hIcon = NULL;
+ wcl.lpszMenuName = NULL;
+ wcl.style = CS_HREDRAW|CS_VREDRAW|CS_GLOBALCLASS|CS_PARENTDC;
RegisterClass(&wcl); /* automatically unregistered on exit */
return 0;
}
diff --git a/src/modules/utils/imgconv.cpp b/src/modules/utils/imgconv.cpp index d4d72f066e..216167316b 100644 --- a/src/modules/utils/imgconv.cpp +++ b/src/modules/utils/imgconv.cpp @@ -53,7 +53,7 @@ void ConvertToPARGB32(HDC hdc, ARGB *pargb, HBITMAP hbmp, SIZE& sizImage, int cx if (*pargbMask++)
{
// transparent pixel
- *pargb++ = 0;
+ *pargb++=0;
}
else
{
diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index bf875f9d74..7ce014725d 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -361,7 +361,7 @@ XCHAR *ReplaceVariables(XCHAR *str, REPLACEVARSDATA *data) if (*p == '%') {
if (varStart) {
if (p == varStart)
- *q++ = '%';
+ *q++='%';
else if (XCHAR *value = GetVariableFromArray(data->variables, varStart, p-varStart, data->hContact, &bFree)) {
_xcscpy(q, value);
q += _xcslen(value);
@@ -377,7 +377,7 @@ XCHAR *ReplaceVariables(XCHAR *str, REPLACEVARSDATA *data) else varStart = p+1;
}
else if ( !varStart)
- *q++ = *p;
+ *q++=*p;
}
*q = 0;
diff --git a/src/modules/utils/resizer.cpp b/src/modules/utils/resizer.cpp index a443fef0ae..0f9b0b418f 100644 --- a/src/modules/utils/resizer.cpp +++ b/src/modules/utils/resizer.cpp @@ -48,7 +48,7 @@ typedef struct { INT_PTR ResizeDialog(WPARAM, LPARAM lParam)
{
- UTILRESIZEDIALOG *urd=(UTILRESIZEDIALOG*)lParam;
+ UTILRESIZEDIALOG *urd = (UTILRESIZEDIALOG*)lParam;
HDWP hDwp;
int i;
DLGITEMTEMPLATE *pItem = NULL;
@@ -62,14 +62,14 @@ INT_PTR ResizeDialog(WPARAM, LPARAM lParam) int extendedDlg, itemCount;
if (urd == NULL || urd->cbSize != sizeof(UTILRESIZEDIALOG)) return 1;
- pTemplate=(DLGTEMPLATE*)LockResource(LoadResource(urd->hInstance, FindResourceA(urd->hInstance, urd->lpTemplate, MAKEINTRESOURCEA(5))));
- pTemplateEx=(START_OF_DLGTEMPLATEEX*)pTemplate;
- extendedDlg=pTemplateEx->signature == 0xFFFF;
+ pTemplate = (DLGTEMPLATE*)LockResource(LoadResource(urd->hInstance, FindResourceA(urd->hInstance, urd->lpTemplate, MAKEINTRESOURCEA(5))));
+ pTemplateEx = (START_OF_DLGTEMPLATEEX*)pTemplate;
+ extendedDlg = pTemplateEx->signature == 0xFFFF;
if (extendedDlg && pTemplateEx->dlgVer != 1)
return 1;
- if (extendedDlg) pWord=(PWORD)(pTemplateEx+1);
- else pWord=(PWORD)(pTemplate+1);
+ if (extendedDlg) pWord = (PWORD)(pTemplateEx+1);
+ else pWord = (PWORD)(pTemplate+1);
if (*pWord == 0xFFFF) pWord+=2; else while (*pWord++); //menu
if (*pWord == 0xFFFF) pWord+=2; else while (*pWord++); //class
while (*pWord++); //title
@@ -86,36 +86,36 @@ INT_PTR ResizeDialog(WPARAM, LPARAM lParam) }
}
- urc.cbSize=sizeof(UTILRESIZECONTROL);
- rc.left=0; rc.top=0;
- if (extendedDlg) {rc.right=pTemplateEx->cx; rc.bottom=pTemplateEx->cy;}
- else {rc.right=pTemplate->cx; rc.bottom=pTemplate->cy;}
+ urc.cbSize = sizeof(UTILRESIZECONTROL);
+ rc.left = 0; rc.top = 0;
+ if (extendedDlg) {rc.right = pTemplateEx->cx; rc.bottom = pTemplateEx->cy;}
+ else {rc.right = pTemplate->cx; rc.bottom = pTemplate->cy;}
MapDialogRect(urd->hwndDlg, &rc);
- urc.dlgOriginalSize.cx=rc.right; urc.dlgOriginalSize.cy=rc.bottom;
+ urc.dlgOriginalSize.cx = rc.right; urc.dlgOriginalSize.cy = rc.bottom;
GetClientRect(urd->hwndDlg, &rc);
- urc.dlgNewSize.cx=rc.right; urc.dlgNewSize.cy=rc.bottom;
+ urc.dlgNewSize.cx = rc.right; urc.dlgNewSize.cy = rc.bottom;
- if (extendedDlg) itemCount=pTemplateEx->cDlgItems;
- else itemCount=pTemplate->cdit;
- hDwp=BeginDeferWindowPos(itemCount);
+ if (extendedDlg) itemCount = pTemplateEx->cDlgItems;
+ else itemCount = pTemplate->cdit;
+ hDwp = BeginDeferWindowPos(itemCount);
for (i=0;i<itemCount;i++) {
if ((UINT_PTR)pWord&2) pWord++; //dword align
if (extendedDlg) {
- pItemEx=(START_OF_DLGITEMTEMPLATEEX*)pWord;
- pWord=(PWORD)(pItemEx+1);
+ pItemEx = (START_OF_DLGITEMTEMPLATEEX*)pWord;
+ pWord = (PWORD)(pItemEx+1);
- urc.wId=pItemEx->id;
- urc.rcItem.left=pItemEx->x; urc.rcItem.top=pItemEx->y;
- urc.rcItem.right=urc.rcItem.left+pItemEx->cx; urc.rcItem.bottom=urc.rcItem.top+pItemEx->cy;
+ urc.wId = pItemEx->id;
+ urc.rcItem.left = pItemEx->x; urc.rcItem.top = pItemEx->y;
+ urc.rcItem.right = urc.rcItem.left+pItemEx->cx; urc.rcItem.bottom = urc.rcItem.top+pItemEx->cy;
}
else {
- pItem=(DLGITEMTEMPLATE*)pWord;
- pWord=(PWORD)(pItem+1);
+ pItem = (DLGITEMTEMPLATE*)pWord;
+ pWord = (PWORD)(pItem+1);
- urc.wId=pItem->id;
- urc.rcItem.left=pItem->x; urc.rcItem.top=pItem->y;
- urc.rcItem.right=urc.rcItem.left+pItem->cx; urc.rcItem.bottom=urc.rcItem.top+pItem->cy;
+ urc.wId = pItem->id;
+ urc.rcItem.left = pItem->x; urc.rcItem.top = pItem->y;
+ urc.rcItem.right = urc.rcItem.left+pItem->cx; urc.rcItem.bottom = urc.rcItem.top+pItem->cy;
}
if (*pWord == 0xFFFF) pWord+=2; else while (*pWord++); //menu
if (*pWord == 0xFFFF) pWord+=2; else while (*pWord++); //class
@@ -124,7 +124,7 @@ INT_PTR ResizeDialog(WPARAM, LPARAM lParam) if (urc.wId == 65535) continue; //using this breaks the dwp, so just ignore it
MapDialogRect(urd->hwndDlg, &urc.rcItem);
- procResult=(urd->pfnResizer)(urd->hwndDlg, urd->lParam, &urc);
+ procResult = (urd->pfnResizer)(urd->hwndDlg, urd->lParam, &urc);
if (procResult&RD_ANCHORX_RIGHT) {
urc.rcItem.left+=urc.dlgNewSize.cx-urc.dlgOriginalSize.cx;
urc.rcItem.right+=urc.dlgNewSize.cx-urc.dlgOriginalSize.cx;
diff --git a/src/modules/utils/timeutils.cpp b/src/modules/utils/timeutils.cpp index 5e921566d5..205457e76d 100644 --- a/src/modules/utils/timeutils.cpp +++ b/src/modules/utils/timeutils.cpp @@ -84,7 +84,7 @@ void FormatTime(const SYSTEMTIME *st, const TCHAR *szFormat, TCHAR *szDest, int default:
if (destCharsLeft--)
- *pDest++ = *pFormat;
+ *pDest++=*pFormat;
continue;
}
diff --git a/src/modules/utils/timezones.cpp b/src/modules/utils/timezones.cpp index bf83dfeb75..f22b18829c 100644 --- a/src/modules/utils/timezones.cpp +++ b/src/modules/utils/timezones.cpp @@ -341,10 +341,10 @@ typedef struct UINT addStr, getSel, setSel, getData, setData;
} ListMessages;
-static const ListMessages lbMessages =
+static const ListMessages lbMessages =
{ LB_ADDSTRING, LB_GETCURSEL, LB_SETCURSEL, LB_GETITEMDATA, LB_SETITEMDATA };
-static const ListMessages cbMessages =
+static const ListMessages cbMessages =
{ CB_ADDSTRING, CB_GETCURSEL, CB_SETCURSEL, CB_GETITEMDATA, CB_SETITEMDATA };
static const ListMessages *GetListMessages(HWND hWnd, DWORD dwFlags)
@@ -382,7 +382,7 @@ static int timeapiSelectListItem(HANDLE hContact, HWND hWnd, DWORD dwFlags) if ( !DBGetContactSettingTString(hContact, "UserInfo", "TzName", &dbv))
{
unsigned hash = mir_hashstrT(dbv.ptszVal);
- for (int i = 0; i < g_timezonesBias.getCount(); ++i)
+ for (int i=0; i < g_timezonesBias.getCount(); ++i)
{
if (hash == g_timezonesBias[i]->hash)
{
@@ -409,7 +409,7 @@ static int timeapiPrepareList(HANDLE hContact, HWND hWnd, DWORD dwFlags) SendMessage(hWnd, lstMsg->addStr, 0, (LPARAM)TranslateT("<unspecified>"));
- for (int i = 0; i < g_timezonesBias.getCount(); ++i)
+ for (int i=0; i < g_timezonesBias.getCount(); ++i)
{
MIM_TIMEZONE *tz = g_timezonesBias[i];
@@ -451,21 +451,21 @@ static INT_PTR GetTimeApi(WPARAM, LPARAM lParam) if (tmi->cbSize != sizeof(TIME_API))
return FALSE;
- tmi->createByName = timeapiGetInfoByName;
- tmi->createByContact = timeapiGetInfoByContact;
- tmi->storeByContact = timeapiSetInfoByContact;
+ tmi->createByName = timeapiGetInfoByName;
+ tmi->createByContact = timeapiGetInfoByContact;
+ tmi->storeByContact = timeapiSetInfoByContact;
- tmi->printDateTime = timeapiPrintDateTime;
- tmi->printTimeStamp = timeapiPrintTimeStamp;
+ tmi->printDateTime = timeapiPrintDateTime;
+ tmi->printTimeStamp = timeapiPrintTimeStamp;
- tmi->prepareList = timeapiPrepareList;
- tmi->selectListItem = timeapiSelectListItem;
- tmi->storeListResults = timeapiStoreListResult;
+ tmi->prepareList = timeapiPrepareList;
+ tmi->selectListItem = timeapiSelectListItem;
+ tmi->storeListResults = timeapiStoreListResult;
- tmi->getTimeZoneTime = timeapiGetTimeZoneTime;
- tmi->timeStampToTimeZoneTimeStamp = timeapiTimeStampToTimeZoneTimeStamp;
- tmi->getTzi = timeapiGetTzi;
- tmi->getTzName = timeapiGetTzName;
+ tmi->getTimeZoneTime = timeapiGetTimeZoneTime;
+ tmi->timeStampToTimeZoneTimeStamp = timeapiTimeStampToTimeZoneTimeStamp;
+ tmi->getTzi = timeapiGetTzi;
+ tmi->getTzName = timeapiGetTzName;
return TRUE;
}
@@ -537,7 +537,7 @@ extern "C" __declspec(dllexport) void RecalculateTime(void) found = true;
}
- for (int i = 0; i < g_timezones.getCount(); ++i)
+ for (int i=0; i < g_timezones.getCount(); ++i)
{
MIM_TIMEZONE &tz = g_timezones[i];
if (tz.offset != INT_MIN) tz.offset = INT_MIN;
diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp index 4af0230071..64941a9b85 100644 --- a/src/modules/utils/utils.cpp +++ b/src/modules/utils/utils.cpp @@ -39,7 +39,7 @@ void UninitTimeZones(void); static BOOL bModuleInitialized = FALSE;
-static struct CountryListEntry countries[]={
+static struct CountryListEntry countries[] = {
{0 , "Unspecified"},
{9999, "Other"},
{0xFFFF, "Unknown"},
@@ -310,7 +310,7 @@ static INT_PTR GetCountryByNumber(WPARAM wParam, LPARAM) static INT_PTR GetCountryList(WPARAM wParam, LPARAM lParam)
{
*(int*)wParam = SIZEOF(countries);
- *(struct CountryListEntry**)lParam=countries;
+ *(struct CountryListEntry**)lParam = countries;
return 0;
}
@@ -318,11 +318,11 @@ static INT_PTR GetCountryList(WPARAM wParam, LPARAM lParam) static INT_PTR SaveWindowPosition(WPARAM, LPARAM lParam)
{
- SAVEWINDOWPOS *swp=(SAVEWINDOWPOS*)lParam;
+ SAVEWINDOWPOS *swp = (SAVEWINDOWPOS*)lParam;
WINDOWPLACEMENT wp;
char szSettingName[64];
- wp.length=sizeof(wp);
+ wp.length = sizeof(wp);
GetWindowPlacement(swp->hwnd, &wp);
mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sx", swp->szNamePrefix);
DBWriteContactSettingDword(swp->hContact, swp->szModule, szSettingName, wp.rcNormalPosition.left);
@@ -377,30 +377,30 @@ static INT_PTR AssertInsideScreen(WPARAM wParam, LPARAM lParam) static INT_PTR RestoreWindowPosition(WPARAM wParam, LPARAM lParam)
{
- SAVEWINDOWPOS *swp=(SAVEWINDOWPOS*)lParam;
+ SAVEWINDOWPOS *swp = (SAVEWINDOWPOS*)lParam;
WINDOWPLACEMENT wp;
char szSettingName[64];
int x, y;
- wp.length=sizeof(wp);
+ wp.length = sizeof(wp);
GetWindowPlacement(swp->hwnd, &wp);
mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sx", swp->szNamePrefix);
- x=DBGetContactSettingDword(swp->hContact, swp->szModule, szSettingName, -1);
+ x = DBGetContactSettingDword(swp->hContact, swp->szModule, szSettingName, -1);
mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sy", swp->szNamePrefix);
- y=(int)DBGetContactSettingDword(swp->hContact, swp->szModule, szSettingName, -1);
+ y = (int)DBGetContactSettingDword(swp->hContact, swp->szModule, szSettingName, -1);
if (x == -1) return 1;
if (wParam&RWPF_NOSIZE) {
OffsetRect(&wp.rcNormalPosition, x-wp.rcNormalPosition.left, y-wp.rcNormalPosition.top);
}
else {
- wp.rcNormalPosition.left=x;
- wp.rcNormalPosition.top=y;
+ wp.rcNormalPosition.left = x;
+ wp.rcNormalPosition.top = y;
mir_snprintf(szSettingName, SIZEOF(szSettingName), "%swidth", swp->szNamePrefix);
- wp.rcNormalPosition.right=wp.rcNormalPosition.left+DBGetContactSettingDword(swp->hContact, swp->szModule, szSettingName, -1);
+ wp.rcNormalPosition.right = wp.rcNormalPosition.left+DBGetContactSettingDword(swp->hContact, swp->szModule, szSettingName, -1);
mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sheight", swp->szNamePrefix);
- wp.rcNormalPosition.bottom=wp.rcNormalPosition.top+DBGetContactSettingDword(swp->hContact, swp->szModule, szSettingName, -1);
+ wp.rcNormalPosition.bottom = wp.rcNormalPosition.top+DBGetContactSettingDword(swp->hContact, swp->szModule, szSettingName, -1);
}
- wp.flags=0;
+ wp.flags = 0;
if (wParam & RWPF_HIDDEN)
wp.showCmd = SW_HIDE;
if (wParam & RWPF_NOACTIVATE)
diff --git a/src/modules/utils/windowlist.cpp b/src/modules/utils/windowlist.cpp index f1ccff236b..7230ab4a23 100644 --- a/src/modules/utils/windowlist.cpp +++ b/src/modules/utils/windowlist.cpp @@ -22,9 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "..\..\core\commonheaders.h"
-static WINDOWLISTENTRY *windowList=NULL;
-static int windowListCount=0;
-static int nextWindowListId=1;
+static WINDOWLISTENTRY *windowList = NULL;
+static int windowListCount = 0;
+static int nextWindowListId = 1;
static INT_PTR AllocWindowList(WPARAM, LPARAM)
{
@@ -33,8 +33,8 @@ static INT_PTR AllocWindowList(WPARAM, LPARAM) static INT_PTR AddToWindowList(WPARAM, LPARAM lParam)
{
- windowList=(WINDOWLISTENTRY*)mir_realloc(windowList, sizeof(WINDOWLISTENTRY)*(windowListCount+1));
- windowList[windowListCount++]=*(WINDOWLISTENTRY*)lParam;
+ windowList = (WINDOWLISTENTRY*)mir_realloc(windowList, sizeof(WINDOWLISTENTRY)*(windowListCount+1));
+ windowList[windowListCount++] = *(WINDOWLISTENTRY*)lParam;
return 0;
}
@@ -62,7 +62,7 @@ static INT_PTR FindInWindowList(WPARAM wParam, LPARAM lParam) static INT_PTR BroadcastToWindowList(WPARAM wParam, LPARAM lParam)
{
int i;
- MSG *msg=(MSG*)lParam;
+ MSG *msg = (MSG*)lParam;
for (i=0;i<windowListCount;i++)
if (windowList[i].hList == (HANDLE)wParam)
SendMessage(windowList[i].hwnd, msg->message, msg->wParam, msg->lParam);
@@ -72,7 +72,7 @@ static INT_PTR BroadcastToWindowList(WPARAM wParam, LPARAM lParam) static INT_PTR BroadcastToWindowListAsync(WPARAM wParam, LPARAM lParam)
{
int i;
- MSG *msg=(MSG*)lParam;
+ MSG *msg = (MSG*)lParam;
for (i=0;i<windowListCount;i++)
if (windowList[i].hList == (HANDLE)wParam)
PostMessage(windowList[i].hwnd, msg->message, msg->wParam, msg->lParam);
@@ -96,6 +96,6 @@ void FreeWindowList(void) mir_free(windowList);
windowList = NULL;
}
- windowListCount=0;
- nextWindowListId=1;
+ windowListCount = 0;
+ nextWindowListId = 1;
}
|