From f4c13c73bf781e48707a3ffc2aad182bb055a4e2 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sat, 19 Jan 2013 17:48:42 +0000 Subject: cleaner version of previous commits git-svn-id: http://svn.miranda-ng.org/main/trunk@3175 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SMS/src/SMS_svc.cpp | 17 ++++++++------- plugins/SMS/src/options.cpp | 2 +- plugins/SMS/src/receive.cpp | 14 ++++++------- plugins/SMS/src/recvdlg.cpp | 4 ++-- plugins/SMS/src/senddlg.cpp | 51 +++++++++++++++++++-------------------------- 5 files changed, 40 insertions(+), 48 deletions(-) diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp index 0264d43139..ed26834349 100644 --- a/plugins/SMS/src/SMS_svc.cpp +++ b/plugins/SMS/src/SMS_svc.cpp @@ -38,18 +38,18 @@ int LoadModules(void) mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_SMS); mi.ptszName=SMS_SEND_STR; mi.pszService=szServiceFunction; - mi.flags=(CMIF_UNICODE); + mi.flags=CMIF_TCHAR; Menu_AddMainMenuItem(&mi); mi.position=-2000070000; mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_SMS); mi.ptszName=SMS_SEND_CM_STR; mi.pszService=szServiceFunction; - mi.flags=(CMIF_UNICODE); + mi.flags=CMIF_TCHAR; ssSMSSettings.hContactMenuItems[0]=Menu_AddContactMenuItem(&mi); - SkinAddNewSoundEx("RecvSMSMsg",PROTOCOL_NAMEA,Translate("Incoming SMS Message")); - SkinAddNewSoundEx("RecvSMSConfirmation",PROTOCOL_NAMEA,Translate("Incoming SMS Confirmation")); + SkinAddNewSoundEx("RecvSMSMsg",PROTOCOL_NAMEA,LPGEN("Incoming SMS Message")); + SkinAddNewSoundEx("RecvSMSConfirmation",PROTOCOL_NAMEA,LPGEN("Incoming SMS Confirmation")); RefreshAccountList(NULL,NULL); @@ -172,18 +172,19 @@ int ReadAckSMS(WPARAM wParam,LPARAM lParam) DBEVENTINFO dbei={0}; dbei.cbSize=sizeof(dbei); - if ((dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)((CLISTEVENT*)lParam)->hDbEvent,0))!=-1) + CLISTEVENT *cle = ((CLISTEVENT*)lParam); + if ((dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)cle->hDbEvent,0))!=-1) { dbei.pBlob=(PBYTE)MEMALLOC(dbei.cbBlob); if (dbei.pBlob) { - if (CallService(MS_DB_EVENT_GET,(WPARAM)((CLISTEVENT*)lParam)->hDbEvent,(LPARAM)&dbei)==0) + if (CallService(MS_DB_EVENT_GET,(WPARAM)cle->hDbEvent,(LPARAM)&dbei)==0) if (dbei.eventType==ICQEVENTTYPE_SMS || dbei.eventType==ICQEVENTTYPE_SMSCONFIRMATION) if (dbei.cbBlob>MIN_SMS_DBEVENT_LEN) { - if (RecvSMSWindowAdd(((CLISTEVENT*)lParam)->hContact,ICQEVENTTYPE_SMSCONFIRMATION,NULL,0,(LPSTR)dbei.pBlob,dbei.cbBlob)) + if (RecvSMSWindowAdd(cle->hContact,ICQEVENTTYPE_SMSCONFIRMATION,NULL,0,(LPSTR)dbei.pBlob,dbei.cbBlob)) { - CallService(MS_DB_EVENT_DELETE,(WPARAM)((CLISTEVENT*)lParam)->hContact,(LPARAM)((CLISTEVENT*)lParam)->hDbEvent); + CallService(MS_DB_EVENT_DELETE,(WPARAM)cle->hContact,(LPARAM)cle->hDbEvent); iRet=0; } } diff --git a/plugins/SMS/src/options.cpp b/plugins/SMS/src/options.cpp index 3ad176f351..5ebe06f253 100644 --- a/plugins/SMS/src/options.cpp +++ b/plugins/SMS/src/options.cpp @@ -37,7 +37,7 @@ INT_PTR CALLBACK DlgProcEditorOptions(HWND hWndDlg, UINT msg, WPARAM wParam, LPA TranslateDialogDefault(hWndDlg); if (DB_SMS_GetStaticStringW(NULL,"Signature",wszSign,SIZEOF(wszSign),NULL)==FALSE) - mir_sntprintf(wszSign,SIZEOF(wszSign),TranslateW(_T("From %s:\r\n\r\n")),GetContactNameW(NULL)); + mir_sntprintf(wszSign,SIZEOF(wszSign),TranslateT("From %s:\r\n\r\n"),GetContactNameW(NULL)); SET_DLG_ITEM_TEXTW(hWndDlg,IDC_SIGNATURE,wszSign); { diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp index 2363b4dc31..f79996259f 100644 --- a/plugins/SMS/src/receive.cpp +++ b/plugins/SMS/src/receive.cpp @@ -170,7 +170,7 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) GetXMLFieldExBuff(lpszXML,dwXMLSize,szBuff,sizeof(szBuff),NULL,"sms_response","error","params","param",NULL); } - mir_sntprintf(wszErrorMessage,SIZEOF(wszErrorMessage),TranslateW(_T("SMS message didn't send by %S to %s because: %S")),szNetwork,wszPhone,lpszErrorDescription); + mir_sntprintf(wszErrorMessage,SIZEOF(wszErrorMessage),TranslateT("SMS message didn't send by %S to %s because: %S"),szNetwork,wszPhone,lpszErrorDescription); ShowWindow(hWndDlg,SW_SHOWNORMAL); EnableWindow(hWndDlg,FALSE); hwndTimeOut=CreateDialog(ssSMSSettings.hInstance,MAKEINTRESOURCE(IDD_SENDSMSTIMEDOUT),hWndDlg,SMSTimedOutDlgProc); @@ -198,8 +198,8 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) GetXMLFieldExBuff(lpszXML,dwXMLSize,szMessageID,sizeof(szMessageID),NULL,"sms_response","message_id",NULL); } else { - SET_DLG_ITEM_TEXTW(hwndAccepted,IDC_ST_SOURCE,TranslateW(_T("From:"))); - SET_DLG_ITEM_TEXTW(hwndAccepted,IDC_ST_MESSAGEID,TranslateW(_T("To:"))); + SET_DLG_ITEM_TEXTW(hwndAccepted,IDC_ST_SOURCE,TranslateT("From:")); + SET_DLG_ITEM_TEXTW(hwndAccepted,IDC_ST_MESSAGEID,TranslateT("To:")); GetXMLFieldExBuff(lpszXML,dwXMLSize,szSource,sizeof(szSource),NULL,"sms_response","from",NULL); GetXMLFieldExBuff(lpszXML,dwXMLSize,szMessageID,sizeof(szMessageID),NULL,"sms_response","to",NULL); } @@ -253,12 +253,12 @@ int handleNewMessage(WPARAM wParam,LPARAM lParam) CopyMemory(pszServiceFunctionName,SMS_READ,sizeof(SMS_READ)); cle.cbSize=sizeof(cle); - cle.flags=CLEF_UNICODE; + cle.flags=CLEF_TCHAR; cle.hContact=hContact; cle.hDbEvent=hDbEvent; cle.hIcon=LoadSkinnedIcon(SKINICON_OTHER_SMS); cle.pszService=szServiceFunction; - mir_sntprintf(szToolTip,SIZEOF(szToolTip),TranslateW(_T("SMS Message from %s")),GetContactNameW(hContact)); + mir_sntprintf(szToolTip,SIZEOF(szToolTip),TranslateT("SMS Message from %s"),GetContactNameW(hContact)); cle.ptszTooltip=szToolTip; CallService(MS_CLIST_ADDEVENT,0,(LPARAM)&cle); } @@ -281,12 +281,12 @@ int handleNewMessage(WPARAM wParam,LPARAM lParam) CopyMemory(pszServiceFunctionName,SMS_READ_ACK,sizeof(SMS_READ_ACK)); cle.cbSize=sizeof(cle); - cle.flags=(CLEF_UNICODE); + cle.flags=CLEF_TCHAR; cle.hContact=hContact; cle.hDbEvent=hDbEvent; cle.hIcon=(HICON)LoadImage(ssSMSSettings.hInstance,MAKEINTRESOURCE(iIcon),IMAGE_ICON,0,0,LR_SHARED); cle.pszService=szServiceFunction; - mir_sntprintf(szToolTip,SIZEOF(szToolTip),TranslateW(_T("SMS Confirmation from %s")),GetContactNameW(hContact)); + mir_sntprintf(szToolTip,SIZEOF(szToolTip),TranslateT("SMS Confirmation from %s"),GetContactNameW(hContact)); cle.ptszTooltip=szToolTip; CallService(MS_CLIST_ADDEVENT,0,(LPARAM)&cle); } diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp index cf76b4e3c5..d765e231b4 100644 --- a/plugins/SMS/src/recvdlg.cpp +++ b/plugins/SMS/src/recvdlg.cpp @@ -199,11 +199,11 @@ HWND RecvSMSWindowAdd(HANDLE hContact,DWORD dwEventType,LPWSTR lpwszPhone,SIZE_T switch(dwEventType){ case ICQEVENTTYPE_SMS: - lpwszTitlepart=TranslateW(_T("Received SMS")); + lpwszTitlepart=TranslateT("Received SMS"); hIcon=LoadSkinnedIcon(SKINICON_OTHER_SMS); break; case ICQEVENTTYPE_SMSCONFIRMATION: - lpwszTitlepart=TranslateW(_T("Received SMS Confirmation")); + 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; diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index c3196bded9..65b8e2c9ed 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -112,26 +112,25 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l psswdWindowData->hBkgBrush=CreateSolidBrush(colour); } { + HWND hwndToolTips=CreateWindowEx(WS_EX_TOPMOST,TOOLTIPS_CLASS,TEXT(""),WS_POPUP,0,0,0,0,NULL,NULL,GetModuleHandle(NULL),NULL); TOOLINFO ti; - HWND hwndToolTips; - hwndToolTips=CreateWindowEx(WS_EX_TOPMOST,TOOLTIPS_CLASS,TEXT(""),WS_POPUP,0,0,0,0,NULL,NULL,GetModuleHandle(NULL),NULL); ZeroMemory(&ti,sizeof(ti)); ti.cbSize=sizeof(ti); ti.uFlags=TTF_IDISHWND|TTF_SUBCLASS; ti.uId=(UINT)GetDlgItem(hWndDlg,IDC_HISTORY); - ti.lpszText=TranslateW(_T("View User's History")); + ti.lpszText=TranslateT("View User's History"); SendMessage(hwndToolTips,TTM_ADDTOOL,0,(LPARAM)&ti); ti.uId=(UINT)GetDlgItem(hWndDlg,IDC_ADDNUMBER); - ti.lpszText=TranslateW(_T("Add Number To The Multiple List")); + ti.lpszText=TranslateT("Add Number To The Multiple List"); SendMessage(hwndToolTips,TTM_ADDTOOL,0,(LPARAM)&ti); ti.uId=(UINT)GetDlgItem(hWndDlg,IDC_SAVENUMBER); - ti.lpszText=TranslateW(_T("Save Number To The User's Details Phonebook")); + ti.lpszText=TranslateT("Save Number To The User's Details Phonebook"); SendMessage(hwndToolTips,TTM_ADDTOOL,0,(LPARAM)&ti); ti.uId=(UINT)GetDlgItem(hWndDlg,IDC_MULTIPLE); - ti.lpszText=TranslateW(_T("Show/Hide Multiple List")); + ti.lpszText=TranslateT("Show/Hide Multiple List"); SendMessage(hwndToolTips,TTM_ADDTOOL,0,(LPARAM)&ti); ti.uId=(UINT)GetDlgItem(hWndDlg,IDC_COUNT); - ti.lpszText=TranslateW(_T("Shows How Much Chars You've Typed")); + ti.lpszText=TranslateT("Shows How Much Chars You've Typed"); SendMessage(hwndToolTips,TTM_ADDTOOL,0,(LPARAM)&ti); } { @@ -211,7 +210,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l if (wParam==TIMERID_MSGSEND) { HWND hwndTimeOut; - WCHAR wszMessage[1028],wszPhone[MAX_PHONE_LEN]; + TCHAR wszMessage[1028],wszPhone[MAX_PHONE_LEN]; if (psswdWindowData->bMultiple) { @@ -224,7 +223,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l }else{ GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,SIZEOF(wszPhone)); } - mir_sntprintf(wszMessage,SIZEOF(wszMessage),TranslateW(_T("The SMS message send to %s timed out.")),wszPhone); + mir_sntprintf(wszMessage,SIZEOF(wszMessage),TranslateT("The SMS message send to %s timed out."),wszPhone); KillTimer(hWndDlg,wParam); ShowWindow(hWndDlg,SW_SHOWNORMAL); EnableWindow(hWndDlg,FALSE); @@ -317,7 +316,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l tvis.item.pszText = wszPhone; TreeView_InsertItem( GetDlgItem(hWndDlg,IDC_NUMBERSLIST), &tvis); } - else MessageBox(hWndDlg,TranslateW(_T("The phone szPhone should start with a + and consist of numbers, spaces, brackets and hyphens only.")),TranslateW(_T("Invalid Phone Number")),MB_OK); + else MessageBox(hWndDlg,TranslateT("The phone szPhone should start with a + and consist of numbers, spaces, brackets and hyphens only."),TranslateT("Invalid Phone Number"),MB_OK); } break; @@ -328,7 +327,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l case IDOK: if ((SIZE_T)GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE) > GetSMSMessageLenMax(hWndDlg)) { - MessageBox(hWndDlg,TranslateW(_T("Message is too long, press OK to continue.")),TranslateW(_T("Error - Message too long")),MB_OK); + MessageBox(hWndDlg,TranslateT("Message is too long, press OK to continue."),TranslateT("Error - Message too long"),MB_OK); }else{ if (psswdWindowData->bMultiple) { @@ -348,20 +347,15 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l EnableWindow(GetDlgItem(hWndDlg,IDC_ADDRESS),FALSE); SendSMSWindowNext(hWndDlg); }else{ - MessageBox(hWndDlg,TranslateW(_T("There must be numbers in the list first.")),TranslateW(_T("No Numbers")),MB_OK); + MessageBox(hWndDlg,TranslateT("There must be numbers in the list first."),TranslateT("No Numbers"),MB_OK); } }else{ WCHAR wszPhone[MAX_PHONE_LEN]; - SIZE_T dwPhoneSize; - - dwPhoneSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,SIZEOF(wszPhone)); + SIZE_T dwPhoneSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,SIZEOF(wszPhone)); if (IsPhoneW(wszPhone,dwPhoneSize)) { - LPWSTR lpwszMessage; - SIZE_T dwMessageSize; - - dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE); - lpwszMessage=(LPWSTR)MEMALLOC((dwMessageSize+4)*sizeof(WCHAR)); + SIZE_T dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE); + LPWSTR lpwszMessage=(LPWSTR)MEMALLOC((dwMessageSize+4)*sizeof(WCHAR)); if (lpwszMessage) { dwMessageSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_MESSAGE,lpwszMessage,(dwMessageSize+2)); @@ -380,7 +374,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l MEMFREE(lpwszMessage); } }else{ - MessageBox(hWndDlg,TranslateW(_T("Valid phone numbers are of the form '+(country code)(phone szPhone)'. The contents of the phone szPhone portion is dependent on the national layout of phone numbers, but often omits the leading zero.")),TranslateW(_T("Invalid phone number")),MB_OK); + MessageBox(hWndDlg,TranslateT("Valid phone numbers are of the form '+(country code)(phone szPhone)'. The contents of the phone szPhone portion is dependent on the national layout of phone numbers, but often omits the leading zero."),TranslateT("Invalid phone number"),MB_OK); SetFocus(GetDlgItem(hWndDlg,IDC_ADDRESS)); SEND_DLG_ITEM_MESSAGE(hWndDlg,IDC_ADDRESS,CB_SETEDITSEL,0,MAKELPARAM(0,-1)); } @@ -408,10 +402,9 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l BOOL bCont=TRUE; char szBuff[MAX_PATH]; WCHAR wszPhone[MAX_PHONE_LEN]; - SIZE_T dwPhoneSize; DBVARIANT dbv; - dwPhoneSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,(SIZEOF(wszPhone)-4)); + SIZE_T dwPhoneSize=GET_DLG_ITEM_TEXTW(hWndDlg,IDC_ADDRESS,wszPhone,(SIZEOF(wszPhone)-4)); if (IsPhoneW(wszPhone,dwPhoneSize)) { if (IsContactPhone(psswdWindowData->hMyContact,wszPhone,dwPhoneSize)==FALSE) @@ -426,7 +419,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l DB_SetStringW(psswdWindowData->hMyContact,"UserInfo",szBuff,wszPhone); } }else{ - MessageBox(hWndDlg, TranslateW(_T("The phone szPhone should start with a + and consist of numbers, spaces, brackets and hyphens only.")),TranslateW(_T("Invalid Phone Number")),MB_OK); + MessageBox(hWndDlg, TranslateT("The phone szPhone should start with a + and consist of numbers, spaces, brackets and hyphens only."),TranslateT("Invalid Phone Number"),MB_OK); } } break; @@ -569,9 +562,7 @@ INT_PTR CALLBACK SMSAcceptedDlgProc(HWND hWndDlg,UINT msg,WPARAM wParam,LPARAM l HWND SendSMSWindowAdd(HANDLE hContact) { HWND hRet=NULL; - SEND_SMS_WINDOW_DATA *psswdWindowData; - - psswdWindowData=(SEND_SMS_WINDOW_DATA*)MEMALLOC(sizeof(SEND_SMS_WINDOW_DATA)); + SEND_SMS_WINDOW_DATA *psswdWindowData=(SEND_SMS_WINDOW_DATA*)MEMALLOC(sizeof(SEND_SMS_WINDOW_DATA)); if (psswdWindowData) { psswdWindowData->hMyContact = hContact; psswdWindowData->hWnd = CreateDialogParam(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_SENDSMS), NULL, SendSmsDlgProc, (LPARAM)psswdWindowData); @@ -584,7 +575,7 @@ HWND SendSMSWindowAdd(HANDLE hContact) ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT); lpwszContactDisplayName=GetContactNameW(hContact); - mir_sntprintf(wszTitle, SIZEOF(wszTitle), _T("%s - %s"), lpwszContactDisplayName, TranslateW(_T("Send SMS"))); + mir_sntprintf(wszTitle, SIZEOF(wszTitle), _T("%s - %s"), lpwszContactDisplayName, TranslateT("Send SMS")); SendMessageW(psswdWindowData->hWnd,WM_SETTEXT,NULL,(LPARAM)wszTitle); SEND_DLG_ITEM_MESSAGEW(psswdWindowData->hWnd,IDC_NAME,CB_ADDSTRING,0,(LPARAM)lpwszContactDisplayName); SEND_DLG_ITEM_MESSAGE(psswdWindowData->hWnd,IDC_NAME,CB_SETCURSEL,0,0); @@ -702,14 +693,14 @@ void SendSMSWindowMultipleSet(HWND hWndDlg,BOOL bMultiple) SendSMSWindowFillTreeView(hWndDlg); EnableWindow(GetDlgItem(hWndDlg,IDC_SAVENUMBER),FALSE); - SET_DLG_ITEM_TEXTW(hWndDlg, IDC_MULTIPLE, TranslateW(_T("<< Single"))); + SET_DLG_ITEM_TEXTW(hWndDlg, IDC_MULTIPLE, TranslateT("<< Single")); if (wp.showCmd==SW_MAXIMIZE) SetWindowPos(hWndDlg, 0, 0, 0, rcWin.right - rcWin.left - (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); SetWindowPos(hWndDlg, 0 ,rcWin.left, rcWin.top, rcWin.right - rcWin.left + (rcList.right-rcList.left) + 11, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); }else{ if (psswdWindowData->hMyContact) AddContactPhonesToCombo(hWndDlg,psswdWindowData->hMyContact); EnableWindow(GetDlgItem(hWndDlg, IDC_SAVENUMBER), TRUE); - SET_DLG_ITEM_TEXTW(hWndDlg, IDC_MULTIPLE, TranslateW(_T("Multiple >>"))); + SET_DLG_ITEM_TEXTW(hWndDlg, IDC_MULTIPLE, TranslateT("Multiple >>")); SetWindowPos(hWndDlg, 0, rcWin.left, rcWin.top, rcWin.right-rcWin.left - (rcList.right-rcList.left) - 11, rcWin.bottom - rcWin.top,SWP_NOZORDER | SWP_NOMOVE); if (wp.showCmd==SW_MAXIMIZE) SetWindowPos(hWndDlg, 0, 0, 0, rcWin.right - rcWin.left + (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); } -- cgit v1.2.3