summaryrefslogtreecommitdiff
path: root/plugins/SMS/src/recvdlg.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-08-27 15:15:33 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-08-27 15:15:33 +0000
commitd6eee2018898f2442883a0aa77ad095b75572cfb (patch)
tree8fbfe32690b9b32e5d47b1958a02f6f6a5fbf000 /plugins/SMS/src/recvdlg.cpp
parent2d37d969153b5fad810984182f747755c1cbc616 (diff)
fix for 64-bit issues & warnings
git-svn-id: http://svn.miranda-ng.org/main/trunk@15043 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SMS/src/recvdlg.cpp')
-rw-r--r--plugins/SMS/src/recvdlg.cpp168
1 files changed, 78 insertions, 90 deletions
diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp
index 14b28bddbb..6cec77af40 100644
--- a/plugins/SMS/src/recvdlg.cpp
+++ b/plugins/SMS/src/recvdlg.cpp
@@ -36,15 +36,15 @@ typedef struct
MCONTACT hContact;
} RECV_SMS_WINDOW_DATA;
-INT_PTR CALLBACK RecvSmsDlgProc (HWND hWndDlg,UINT message,WPARAM wParam,LPARAM lParam);
+INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam);
#define GET_WINDOW_DATA(hWndDlg) ((RECV_SMS_WINDOW_DATA*)GetWindowLongPtr(hWndDlg,GWLP_USERDATA))
-
+
DWORD RecvSMSWindowInitialize()
{
DWORD dwRetErrorCode;
- dwRetErrorCode=ListMTInitialize(&ssSMSSettings.lmtRecvSMSWindowsListMT,0);
-return(dwRetErrorCode);
+ dwRetErrorCode = ListMTInitialize(&ssSMSSettings.lmtRecvSMSWindowsListMT, 0);
+ return(dwRetErrorCode);
}
//This function destroy all SMS receive windows
@@ -53,8 +53,7 @@ void RecvSMSWindowDestroy()
RECV_SMS_WINDOW_DATA *prswdWindowData;
ListMTLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
- while (ListMTItemGetFirst(&ssSMSSettings.lmtRecvSMSWindowsListMT,NULL,(LPVOID*)&prswdWindowData)==NO_ERROR)
- {// цикл
+ while (ListMTItemGetFirst(&ssSMSSettings.lmtRecvSMSWindowsListMT, NULL, (LPVOID*)&prswdWindowData) == NO_ERROR) {// цикл
RecvSMSWindowRemove(prswdWindowData->hWnd);
}
ListMTUnLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
@@ -62,89 +61,82 @@ void RecvSMSWindowDestroy()
}
-INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM lParam)
+INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- RECV_SMS_WINDOW_DATA *prswdWindowData=GET_WINDOW_DATA(hWndDlg);
+ RECV_SMS_WINDOW_DATA *prswdWindowData = GET_WINDOW_DATA(hWndDlg);
- switch(message){
+ switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hWndDlg); //Translate intially - bid
- prswdWindowData=(RECV_SMS_WINDOW_DATA*)lParam;
- SetWindowLongPtr(hWndDlg,GWLP_USERDATA,(LONG_PTR)lParam);
+ prswdWindowData = (RECV_SMS_WINDOW_DATA*)lParam;
+ SetWindowLongPtr(hWndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
- mir_subclassWindow(GetDlgItem(hWndDlg,IDC_MESSAGE), MessageSubclassProc);
+ mir_subclassWindow(GetDlgItem(hWndDlg, IDC_MESSAGE), MessageSubclassProc);
{
LOGFONT lf;
- HFONT hFont=(HFONT)SendDlgItemMessage(hWndDlg,IDC_MESSAGE,WM_GETFONT,0,0);
- if (hFont && hFont!=(HFONT)SendDlgItemMessage(hWndDlg,IDOK,WM_GETFONT,0,0)) DeleteObject(hFont);
- LoadMsgDlgFont(MSGFONTID_YOURMSG,&lf,NULL);
- hFont=CreateFontIndirect(&lf);
- SendDlgItemMessage(hWndDlg,IDC_MESSAGE,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(TRUE,0));
-
- COLORREF colour=db_get_dw(NULL,SRMMMOD,SRMSGSET_BKGCOLOUR,SRMSGDEFSET_BKGCOLOUR);
- prswdWindowData->hBkgBrush=CreateSolidBrush(colour);
+ HFONT hFont = (HFONT)SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
+ if (hFont && hFont != (HFONT)SendDlgItemMessage(hWndDlg, IDOK, WM_GETFONT, 0, 0)) DeleteObject(hFont);
+ LoadMsgDlgFont(MSGFONTID_YOURMSG, &lf, NULL);
+ hFont = CreateFontIndirect(&lf);
+ SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
+
+ COLORREF colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
+ prswdWindowData->hBkgBrush = CreateSolidBrush(colour);
}
- if (Utils_RestoreWindowPosition(hWndDlg,(DB_SMS_GetByte(NULL,"SavePerContact",0)? prswdWindowData->hContact:NULL),PROTOCOL_NAMEA,"recv"))
- {// def pos
- SetWindowPos(hWndDlg,0,200,200,400,350,SWP_NOZORDER);
- }
- InvalidateRect(GetDlgItem(hWndDlg,IDC_MESSAGE),NULL,FALSE);
+ // def pos
+ if (Utils_RestoreWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? prswdWindowData->hContact : NULL), PROTOCOL_NAMEA, "recv"))
+ SetWindowPos(hWndDlg, 0, 200, 200, 400, 350, SWP_NOZORDER);
+
+ InvalidateRect(GetDlgItem(hWndDlg, IDC_MESSAGE), NULL, FALSE);
break;
case WM_CTLCOLORSTATIC:
- if ((HWND)lParam==GetDlgItem(hWndDlg,IDC_MESSAGE)) {
+ if ((HWND)lParam == GetDlgItem(hWndDlg, IDC_MESSAGE)) {
COLORREF colour;
- LoadMsgDlgFont(MSGFONTID_YOURMSG,NULL,&colour);
- SetTextColor((HDC)wParam,colour);
- SetBkColor((HDC)wParam,db_get_dw(NULL,SRMMMOD,SRMSGSET_BKGCOLOUR,SRMSGDEFSET_BKGCOLOUR));
- return((BOOL)prswdWindowData->hBkgBrush);
+ LoadMsgDlgFont(MSGFONTID_YOURMSG, NULL, &colour);
+ SetTextColor((HDC)wParam, colour);
+ SetBkColor((HDC)wParam, db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
+ return (INT_PTR)prswdWindowData->hBkgBrush;
}
break;
case WM_GETMINMAXINFO:
- ((LPMINMAXINFO)lParam)->ptMinTrackSize.x=300;
- ((LPMINMAXINFO)lParam)->ptMinTrackSize.y=230;
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 300;
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = 230;
break;
case WM_SIZE:
+ RECT rcWin;
+ GetWindowRect(hWndDlg, &rcWin);
{
- int cx,cy;
- RECT rcWin;
-
- GetWindowRect(hWndDlg,&rcWin);
- cx = rcWin.right - rcWin.left;
- cy = rcWin.bottom - rcWin.top;
- cx -= 10; /* XXX: fix window sizes for aero. */
- cy -= 10;
- SetWindowPos(GetDlgItem(hWndDlg,IDC_MESSAGE),0,0,0,cx - 14,cy - 112,SWP_NOZORDER|SWP_NOMOVE);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_NAME),0,0,0,(cx*35)/100,20,SWP_NOZORDER|SWP_NOMOVE);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_NUMBER),0,cx - (cx*35)/100 - 11,5,(cx*35)/100,20,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_ST_NUMBER),0,cx - (cx*35)/100 - 58,5,40,20,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDC_READNEXT),0,cx - 87, cy - 60,80,25,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDOK),0,cx/2 - 87,cy - 60,80,25,SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hWndDlg,IDCANCEL),0,cx/2 + 7,cy - 60,80,25,SWP_NOZORDER);
-
- RedrawWindow(hWndDlg,NULL,NULL,RDW_FRAME|RDW_INVALIDATE);
+ int cx = rcWin.right - rcWin.left - 10;
+ int cy = rcWin.bottom - rcWin.top - 10;
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_MESSAGE), 0, 0, 0, cx - 14, cy - 112, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_NAME), 0, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_NUMBER), 0, cx - (cx * 35) / 100 - 11, 5, (cx * 35) / 100, 20, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_NUMBER), 0, cx - (cx * 35) / 100 - 58, 5, 40, 20, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDC_READNEXT), 0, cx - 87, cy - 60, 80, 25, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDOK), 0, cx / 2 - 87, cy - 60, 80, 25, SWP_NOZORDER);
+ SetWindowPos(GetDlgItem(hWndDlg, IDCANCEL), 0, cx / 2 + 7, cy - 60, 80, 25, SWP_NOZORDER);
}
+ RedrawWindow(hWndDlg, NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
break;
+
case WM_COMMAND:
- switch(LOWORD(wParam)){
+ switch (LOWORD(wParam)) {
case IDOK:
{
WCHAR wszPhone[MAX_PHONE_LEN];
- HWND hwndSendSms;
- MCONTACT hContact;
-
- hContact=HContactFromPhone(wszPhone,GetDlgItemText(hWndDlg,IDC_NUMBER,wszPhone,_countof(wszPhone)));
- hwndSendSms=SendSMSWindowIsOtherInstanceHContact(hContact);
+ MCONTACT hContact = HContactFromPhone(wszPhone, GetDlgItemText(hWndDlg, IDC_NUMBER, wszPhone, _countof(wszPhone)));
+ HWND hwndSendSms = SendSMSWindowIsOtherInstanceHContact(hContact);
if (hwndSendSms)
SetFocus(hwndSendSms);
else {
- hwndSendSms=SendSMSWindowAdd(prswdWindowData->hContact);
- SetDlgItemText(hwndSendSms,IDC_ADDRESS,wszPhone);
+ hwndSendSms = SendSMSWindowAdd(prswdWindowData->hContact);
+ SetDlgItemText(hwndSendSms, IDC_ADDRESS, wszPhone);
}
}
case IDCANCEL:
@@ -175,36 +167,34 @@ HWND RecvSMSWindowAdd(MCONTACT hContact, DWORD dwEventType, LPWSTR lpwszPhone, s
LPWSTR lpwszMessage;
lpwszMessage = (LPWSTR)MEMALLOC(((dwMessageSize + MAX_PATH) * sizeof(WCHAR)));
- if ( !lpwszMessage)
+ if (!lpwszMessage)
return NULL;
RECV_SMS_WINDOW_DATA *prswdWindowData;
prswdWindowData = (RECV_SMS_WINDOW_DATA*)MEMALLOC(sizeof(RECV_SMS_WINDOW_DATA));
- if (prswdWindowData)
- {
- prswdWindowData->hContact=hContact;
- prswdWindowData->hWnd=CreateDialogParam(ssSMSSettings.hInstance,MAKEINTRESOURCE(IDD_RECVSMS),NULL,RecvSmsDlgProc,(LPARAM)prswdWindowData);
- if (prswdWindowData->hWnd)
- {
+ if (prswdWindowData) {
+ prswdWindowData->hContact = hContact;
+ prswdWindowData->hWnd = CreateDialogParam(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_RECVSMS), NULL, RecvSmsDlgProc, (LPARAM)prswdWindowData);
+ if (prswdWindowData->hWnd) {
HICON hIcon;
- WCHAR wszTitle[MAX_PATH]={0},wszPhoneLocal[MAX_PHONE_LEN]={0};
+ WCHAR wszTitle[MAX_PATH] = { 0 }, wszPhoneLocal[MAX_PHONE_LEN] = { 0 };
UINT iIcon;
- LPWSTR lpwszContactDisplayName,lpwszTitlepart;
+ LPWSTR lpwszContactDisplayName, lpwszTitlepart;
ListMTLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
- ListMTItemAdd(&ssSMSSettings.lmtRecvSMSWindowsListMT,&prswdWindowData->lmtListMTItem,prswdWindowData);
+ ListMTItemAdd(&ssSMSSettings.lmtRecvSMSWindowsListMT, &prswdWindowData->lmtListMTItem, prswdWindowData);
ListMTUnLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
- switch(dwEventType){
+ switch (dwEventType) {
case ICQEVENTTYPE_SMS:
- lpwszTitlepart=TranslateT("Received SMS");
- hIcon=Skin_LoadIcon(SKINICON_OTHER_SMS);
+ lpwszTitlepart = TranslateT("Received SMS");
+ hIcon = Skin_LoadIcon(SKINICON_OTHER_SMS);
break;
case ICQEVENTTYPE_SMSCONFIRMATION:
- lpwszTitlepart=TranslateT("Received SMS Confirmation");
- GetDataFromMessage(lpszMessage,dwMessageSize,NULL,NULL,0,NULL,&iIcon);
- hIcon=(HICON)LoadImage(ssSMSSettings.hInstance,MAKEINTRESOURCE(iIcon),IMAGE_ICON,0,0,LR_SHARED);
+ lpwszTitlepart = TranslateT("Received SMS Confirmation");
+ GetDataFromMessage(lpszMessage, dwMessageSize, NULL, NULL, 0, NULL, &iIcon);
+ hIcon = (HICON)LoadImage(ssSMSSettings.hInstance, MAKEINTRESOURCE(iIcon), IMAGE_ICON, 0, 0, LR_SHARED);
break;
default:
lpwszTitlepart = _T("Unknown event type");
@@ -213,24 +203,24 @@ HWND RecvSMSWindowAdd(MCONTACT hContact, DWORD dwEventType, LPWSTR lpwszPhone, s
wszPhoneLocal[0] = '+';
if (dwPhoneSize)
- dwPhoneSize = CopyNumberW((wszPhoneLocal+1),lpwszPhone,dwPhoneSize);
+ dwPhoneSize = CopyNumberW((wszPhoneLocal + 1), lpwszPhone, dwPhoneSize);
else {
- GetDataFromMessage(lpszMessage,dwMessageSize,NULL,(wszPhoneLocal+1),(_countof(wszPhoneLocal)-1),&dwPhoneSize,NULL);
+ GetDataFromMessage(lpszMessage, dwMessageSize, NULL, (wszPhoneLocal + 1), (_countof(wszPhoneLocal) - 1), &dwPhoneSize, NULL);
dwPhoneSize++;
}
lpwszContactDisplayName = pcli->pfnGetContactDisplayName(hContact, 0);
- mir_sntprintf(wszTitle, _countof(wszTitle),_T("%s - %s"), lpwszContactDisplayName, lpwszTitlepart);
- MultiByteToWideChar(CP_UTF8, 0, lpszMessage, (int)dwMessageSize, lpwszMessage, (int)dwMessageSize+MAX_PATH);
+ mir_sntprintf(wszTitle, _countof(wszTitle), _T("%s - %s"), lpwszContactDisplayName, lpwszTitlepart);
+ MultiByteToWideChar(CP_UTF8, 0, lpszMessage, (int)dwMessageSize, lpwszMessage, (int)dwMessageSize + MAX_PATH);
SetWindowText(prswdWindowData->hWnd, wszTitle);
- SetDlgItemText(prswdWindowData->hWnd,IDC_NAME,lpwszContactDisplayName);
- SetDlgItemText(prswdWindowData->hWnd,IDC_NUMBER,wszPhoneLocal);
- SetDlgItemText(prswdWindowData->hWnd,IDC_MESSAGE,lpwszMessage);
- SendMessage(prswdWindowData->hWnd,WM_SETICON,ICON_BIG,(LPARAM)hIcon);
+ SetDlgItemText(prswdWindowData->hWnd, IDC_NAME, lpwszContactDisplayName);
+ SetDlgItemText(prswdWindowData->hWnd, IDC_NUMBER, wszPhoneLocal);
+ SetDlgItemText(prswdWindowData->hWnd, IDC_MESSAGE, lpwszMessage);
+ SendMessage(prswdWindowData->hWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
- SetFocus(GetDlgItem(prswdWindowData->hWnd,IDC_MESSAGE));
- hRet=prswdWindowData->hWnd;
+ SetFocus(GetDlgItem(prswdWindowData->hWnd, IDC_MESSAGE));
+ hRet = prswdWindowData->hWnd;
}
else MEMFREE(prswdWindowData);
}
@@ -242,17 +232,15 @@ HWND RecvSMSWindowAdd(MCONTACT hContact, DWORD dwEventType, LPWSTR lpwszPhone, s
//The function gets the HWND of the window that should be removed and return void
void RecvSMSWindowRemove(HWND hWndDlg)
{
- RECV_SMS_WINDOW_DATA *prswdWindowData=GET_WINDOW_DATA(hWndDlg);
+ RECV_SMS_WINDOW_DATA *prswdWindowData = GET_WINDOW_DATA(hWndDlg);
+
+ if (prswdWindowData) {
+ Utils_SaveWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? prswdWindowData->hContact : NULL), PROTOCOL_NAMEA, "recv");
- if (prswdWindowData)
- {
- Utils_SaveWindowPosition(hWndDlg,(DB_SMS_GetByte(NULL,"SavePerContact",0)? prswdWindowData->hContact:NULL),PROTOCOL_NAMEA,"recv");
-
ListMTLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
- ListMTItemDelete(&ssSMSSettings.lmtRecvSMSWindowsListMT,&prswdWindowData->lmtListMTItem);
+ ListMTItemDelete(&ssSMSSettings.lmtRecvSMSWindowsListMT, &prswdWindowData->lmtListMTItem);
ListMTUnLock(&ssSMSSettings.lmtRecvSMSWindowsListMT);
MEMFREE(prswdWindowData);
}
DestroyWindow(hWndDlg);
}
-