summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu/src/token.cpp
diff options
context:
space:
mode:
authorGoraf <22941576+Goraf@users.noreply.github.com>2018-01-08 22:48:19 +0100
committerGoraf <22941576+Goraf@users.noreply.github.com>2018-01-19 01:39:33 +0100
commitdb084380729ecb18021aa0a5b3074c1faffb18c1 (patch)
tree91c49c311598f0abc294f4dfb8c7ea625f2085d6 /protocols/Gadu-Gadu/src/token.cpp
parent44a8248b1b19375130144a783d1758e1f83d3c88 (diff)
Gadu-Gadu: code cleaning
Diffstat (limited to 'protocols/Gadu-Gadu/src/token.cpp')
-rw-r--r--protocols/Gadu-Gadu/src/token.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp
index be13895b5d..5ac569e9e2 100644
--- a/protocols/Gadu-Gadu/src/token.cpp
+++ b/protocols/Gadu-Gadu/src/token.cpp
@@ -40,64 +40,64 @@ INT_PTR CALLBACK gg_tokendlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
{
GGTOKENDLGDATA *dat = (GGTOKENDLGDATA *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch(msg)
+ switch (msg)
{
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
+ {
+ RECT rc;
+ TranslateDialogDefault(hwndDlg);
+ GetClientRect(GetDlgItem(hwndDlg, IDC_WHITERECT), &rc);
+ InvalidateRect(hwndDlg, &rc, TRUE);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+ return TRUE;
+ }
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
{
- RECT rc;
- TranslateDialogDefault(hwndDlg);
- GetClientRect(GetDlgItem(hwndDlg, IDC_WHITERECT), &rc);
- InvalidateRect(hwndDlg, &rc, TRUE);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- return TRUE;
+ case IDOK:
+ {
+ GetDlgItemTextA(hwndDlg, IDC_TOKEN, dat->val, _countof(dat->val));
+ EndDialog(hwndDlg, IDOK);
+ break;
}
-
- case WM_COMMAND:
- switch(LOWORD(wParam))
- {
- case IDOK:
- {
- GetDlgItemTextA(hwndDlg, IDC_TOKEN, dat->val, _countof(dat->val));
- EndDialog(hwndDlg, IDOK);
- break;
- }
- case IDCANCEL:
- EndDialog(hwndDlg, IDCANCEL);
- break;
- }
+ case IDCANCEL:
+ EndDialog(hwndDlg, IDCANCEL);
break;
+ }
+ break;
- case WM_PAINT:
+ case WM_PAINT:
+ {
+ PAINTSTRUCT paintStruct;
+ HDC hdc = BeginPaint(hwndDlg, &paintStruct);
+ RECT rc;
+ GetClientRect(GetDlgItem(hwndDlg, IDC_WHITERECT), &rc);
+ FillRect(hdc, &rc, (HBRUSH)GetStockObject(WHITE_BRUSH));
+
+ if (dat && dat->hBitmap)
{
- PAINTSTRUCT paintStruct;
- HDC hdc = BeginPaint(hwndDlg, &paintStruct);
- RECT rc; GetClientRect(GetDlgItem(hwndDlg, IDC_WHITERECT), &rc);
- FillRect(hdc, &rc, (HBRUSH)GetStockObject(WHITE_BRUSH));
+ HDC hdcBmp = nullptr;
+ BITMAP bmp;
+ GetObject(dat->hBitmap, sizeof(bmp), &bmp);
+ int nWidth = bmp.bmWidth;
+ int nHeight = bmp.bmHeight;
- if (dat && dat->hBitmap)
+ if (hdcBmp = CreateCompatibleDC(hdc))
{
- HDC hdcBmp = nullptr;
- int nWidth, nHeight;
- BITMAP bmp;
-
- GetObject(dat->hBitmap, sizeof(bmp), &bmp);
- nWidth = bmp.bmWidth; nHeight = bmp.bmHeight;
-
- if (hdcBmp = CreateCompatibleDC(hdc))
- {
- SelectObject(hdcBmp, dat->hBitmap);
- SetStretchBltMode(hdc, HALFTONE);
- BitBlt(hdc,
- (rc.left + rc.right - nWidth) / 2,
- (rc.top + rc.bottom - nHeight) / 2,
- nWidth, nHeight,
- hdcBmp, 0, 0, SRCCOPY);
- DeleteDC(hdcBmp);
- }
+ SelectObject(hdcBmp, dat->hBitmap);
+ SetStretchBltMode(hdc, HALFTONE);
+ BitBlt(hdc,
+ (rc.left + rc.right - nWidth) / 2,
+ (rc.top + rc.bottom - nHeight) / 2,
+ nWidth, nHeight,
+ hdcBmp, 0, 0, SRCCOPY);
+ DeleteDC(hdcBmp);
}
- EndPaint(hwndDlg, &paintStruct);
- return 0;
}
+ EndPaint(hwndDlg, &paintStruct);
+ return 0;
+ }
}
return FALSE;
}
@@ -130,18 +130,18 @@ int GGPROTO::gettoken(GGTOKEN *token)
}
// Return token id
- GGTOKENDLGDATA dat = {0};
+ GGTOKENDLGDATA dat = { 0 };
strncpy(dat.id, t->tokenid, sizeof(dat.id));
dat.width = t->width;
dat.height = t->height;
// Load bitmap
- IMGSRVC_MEMIO memio = {0};
+ IMGSRVC_MEMIO memio = { 0 };
memio.iLen = h->body_size;
memio.pBuf = h->body;
memio.fif = FIF_UNKNOWN; /* detect */
memio.flags = 0;
- dat.hBitmap = (HBITMAP) CallService(MS_IMG_LOADFROMMEM, (WPARAM) &memio, 0);
+ dat.hBitmap = (HBITMAP)CallService(MS_IMG_LOADFROMMEM, (WPARAM)&memio, 0);
if (dat.hBitmap == nullptr)
{
MessageBox(nullptr, TranslateT("Could not load token image."), m_tszUserName, MB_OK | MB_ICONSTOP);