diff options
-rw-r--r-- | src/core/stduserinfo/contactinfo.cpp | 138 | ||||
-rw-r--r-- | src/core/stduserinfo/stdinfo.cpp | 331 | ||||
-rw-r--r-- | src/core/stduserinfo/userinfo.cpp | 131 |
3 files changed, 318 insertions, 282 deletions
diff --git a/src/core/stduserinfo/contactinfo.cpp b/src/core/stduserinfo/contactinfo.cpp index 031a9e40ab..71152950f1 100644 --- a/src/core/stduserinfo/contactinfo.cpp +++ b/src/core/stduserinfo/contactinfo.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-2009 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -102,13 +102,15 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar case IDCANCEL:
EndDialog(hwndDlg, wParam);
case IDC_COUNTRY:
- if (HIWORD(wParam) != CBN_SELCHANGE) break;
+ if (HIWORD(wParam) != CBN_SELCHANGE)
+ break;
case IDC_AREA:
case IDC_NUMBER:
if (LOWORD(wParam) != IDC_COUNTRY && HIWORD(wParam) != EN_CHANGE) break;
if (noRecursion) break;
EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
- { char szPhone[96], szArea[32], szNumber[64];
+ {
+ char szPhone[96], szArea[32], szNumber[64];
GetDlgItemTextA(hwndDlg, IDC_AREA, szArea, SIZEOF(szArea));
GetDlgItemTextA(hwndDlg, IDC_NUMBER, szNumber, SIZEOF(szNumber));
mir_snprintf(szPhone, SIZEOF(szPhone), "+%u (%s) %s", SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETCURSEL, 0, 0), 0), szArea, szNumber);
@@ -121,15 +123,15 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar if (HIWORD(wParam) != EN_UPDATE) break;
if (noRecursion) break;
noRecursion = 1;
- {
+ {
char szText[256], *pText = NULL, *pArea, *pNumber;
- int isValid = 1;
+ int i, isValid = 1;
GetDlgItemTextA(hwndDlg, IDC_PHONE, szText, SIZEOF(szText));
if (szText[0] != '+')
isValid = 0;
if (isValid) {
- int i, country = strtol(szText+1, &pText, 10);
+ int country = strtol(szText+1, &pText, 10);
if (pText - szText > 4)
isValid = 0;
else {
@@ -169,30 +171,35 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar static int IsOverEmail(HWND hwndDlg, TCHAR* szEmail, int cchEmail)
{
- RECT rc;
- HWND hwndEmails;
- TCHAR szText[256];
- HDC hdc;
- SIZE textSize;
- LVHITTESTINFO hti;
+ HWND hwndEmails = GetDlgItem(hwndDlg, IDC_EMAILS);
- hwndEmails = GetDlgItem(hwndDlg, IDC_EMAILS);
+ LVHITTESTINFO hti;
GetCursorPos(&hti.pt);
ScreenToClient(hwndEmails, &hti.pt);
+
+ RECT rc;
GetClientRect(hwndEmails, &rc);
- if ( !PtInRect(&rc, hti.pt)) return 0;
- if (ListView_SubItemHitTest(hwndEmails, &hti) == -1) return 0;
- if (hti.iSubItem != 1) return 0;
- if ( !(hti.flags&LVHT_ONITEMLABEL)) return 0;
+ if ( !PtInRect(&rc, hti.pt))
+ return 0;
+ if (ListView_SubItemHitTest(hwndEmails, &hti) == -1)
+ return 0;
+ if (hti.iSubItem != 1 || !(hti.flags & LVHT_ONITEMLABEL))
+ return 0;
+
ListView_GetSubItemRect(hwndEmails, hti.iItem, 1, LVIR_LABEL, &rc);
- szText[0] = 0;
+
+ TCHAR szText[256]; szText[0] = 0;
ListView_GetItemText(hwndEmails, hti.iItem, 1, szText, SIZEOF(szText));
- hdc = GetDC(hwndEmails);
+
+ HDC hdc = GetDC(hwndEmails);
SelectObject(hdc, hEmailFont);
+
+ SIZE textSize;
GetTextExtentPoint32(hdc, szText, lstrlen(szText), &textSize);
ReleaseDC(hwndEmails, hdc);
- if (hti.pt.x<rc.left+textSize.cx) {
- if (szEmail && cchEmail) lstrcpyn(szEmail, szText, cchEmail);
+ if (hti.pt.x < rc.left+textSize.cx) {
+ if (szEmail && cchEmail)
+ lstrcpyn(szEmail, szText, cchEmail);
return 1;
}
return 0;
@@ -201,22 +208,22 @@ static int IsOverEmail(HWND hwndDlg, TCHAR* szEmail, int cchEmail) #define M_REMAKELISTS (WM_USER+1)
INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ int i;
+
switch(msg) {
case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
if (hEmailFont) DeleteObject(hEmailFont);
- {
+ {
LOGFONT lf;
hEmailFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_EMAILS, WM_GETFONT, 0, 0);
GetObject(hEmailFont, sizeof(lf), &lf);
lf.lfUnderline = 1;
hEmailFont = CreateFontIndirect(&lf);
}
- if (hHandCursor == NULL) {
- if ( IsWinVer2000Plus()) hHandCursor = LoadCursor(NULL, IDC_HAND);
- else hHandCursor = LoadCursor(hInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND));
- }
- TranslateDialogDefault(hwndDlg);
+ if (hHandCursor == NULL)
+ hHandCursor = ( IsWinVer2000Plus()) ? LoadCursor(NULL, IDC_HAND) : LoadCursor(hInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND));
{
LVCOLUMN lvc;
RECT rc;
@@ -244,7 +251,6 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case M_REMAKELISTS:
{
- int i;
HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (hContact != NULL) {
char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
@@ -263,7 +269,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP lvi.lParam = (LPARAM)(-1);
lvi.iSubItem = 0;
lvi.iItem = 0;
- for (i = -1;;i++) {
+ for (i = -1;; i++) {
if (i == -1) {
if (DBGetContactSettingTString(hContact, szProto, "e-mail", &dbv))
continue;
@@ -381,11 +387,12 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP {
NMLVCUSTOMDRAW *nm = (NMLVCUSTOMDRAW*)lParam;
switch(nm->nmcd.dwDrawStage) {
- case CDDS_PREPAINT:
- case CDDS_ITEMPREPAINT:
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_NOTIFYSUBITEMDRAW);
- return TRUE;
- case CDDS_SUBITEM|CDDS_ITEMPREPAINT:
+ case CDDS_PREPAINT:
+ case CDDS_ITEMPREPAINT:
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_NOTIFYSUBITEMDRAW);
+ return TRUE;
+
+ case CDDS_SUBITEM|CDDS_ITEMPREPAINT:
{
RECT rc;
ListView_GetSubItemRect(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, LVIR_LABEL, &rc);
@@ -429,7 +436,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP LVITEM lvi;
TCHAR szEmail[256];
HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- char *szIdTemplate = nm->hdr.idFrom == IDC_PHONES?"MyPhone%d":"Mye-mail%d";
+ char *szIdTemplate = (nm->hdr.idFrom == IDC_PHONES) ? "MyPhone%d" : "Mye-mail%d";
LVHITTESTINFO hti;
if (IsOverEmail(hwndDlg, szEmail, SIZEOF(szEmail))) {
@@ -464,41 +471,36 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
}
}
- else {
- if (hti.iSubItem-3 == (nm->hdr.idFrom == IDC_PHONES)) {
- //delete
- int i;
- char idstr[33];
- DBVARIANT dbv;
- for (i = lvi.lParam;;i++) {
- mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i+1);
- if (DBGetContactSettingString(hContact, "UserInfo", idstr, &dbv)) break;
- mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i);
- DBWriteContactSettingString(hContact, "UserInfo", idstr, dbv.pszVal);
- DBFreeVariant(&dbv);
- }
- mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i);
- DBDeleteContactSetting(hContact, "UserInfo", idstr);
- SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
- }
- else if (hti.iSubItem-2 == (nm->hdr.idFrom == IDC_PHONES)) {
- //edit
- char szText[256], idstr[33];
- DBVARIANT dbv;
- mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, lvi.lParam);
+ else if (hti.iSubItem-3 == (nm->hdr.idFrom == IDC_PHONES)) {
+ //delete
+ char idstr[33];
+ DBVARIANT dbv;
+ for (i = lvi.lParam;;i++) {
+ mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i+1);
if (DBGetContactSettingString(hContact, "UserInfo", idstr, &dbv)) break;
- lstrcpynA(szText, dbv.pszVal, SIZEOF(szText));
+ mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i);
+ DBWriteContactSettingString(hContact, "UserInfo", idstr, dbv.pszVal);
DBFreeVariant(&dbv);
- if (IDOK != DialogBoxParam(hInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc, (LPARAM)szText))
- break;
- DBWriteContactSettingString(hContact, "UserInfo", idstr, szText);
- SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
}
+ mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i);
+ DBDeleteContactSetting(hContact, "UserInfo", idstr);
+ SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
+ }
+ else if (hti.iSubItem-2 == (nm->hdr.idFrom == IDC_PHONES)) {
+ //edit
+ char szText[256], idstr[33];
+ DBVARIANT dbv;
+ mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, lvi.lParam);
+ if (DBGetContactSettingString(hContact, "UserInfo", idstr, &dbv)) break;
+ lstrcpynA(szText, dbv.pszVal, SIZEOF(szText));
+ DBFreeVariant(&dbv);
+ if (IDOK != DialogBoxParam(hInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc, (LPARAM)szText))
+ break;
+ DBWriteContactSettingString(hContact, "UserInfo", idstr, szText);
+ SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
}
- break;
}
}
- break;
}
break;
@@ -518,9 +520,9 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_COMMAND:
switch(LOWORD(wParam)) {
- case IDCANCEL:
- SendMessage(GetParent(hwndDlg), msg, wParam, lParam);
- break;
+ case IDCANCEL:
+ SendMessage(GetParent(hwndDlg), msg, wParam, lParam);
+ break;
}
break;
}
diff --git a/src/core/stduserinfo/stdinfo.cpp b/src/core/stduserinfo/stdinfo.cpp index 008f2d0b74..d717b7f68e 100644 --- a/src/core/stduserinfo/stdinfo.cpp +++ b/src/core/stduserinfo/stdinfo.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-2009 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -65,94 +65,107 @@ static void Proto_FreeInfoVariant(DBVARIANT *dbv) static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule, char *szSetting, int special)
{
- DBVARIANT dbv = { 0 };
char str[80], *pstr = NULL;
TCHAR* ptstr = NULL;
- int unspecified = 0;
char* szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
bool proto_service = szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC);
- dbv.type = DBVT_DELETED;
- if (szModule == NULL) unspecified = 1;
- else if (proto_service) unspecified = Proto_GetContactInfoSetting(hContact, szProto, szModule, szSetting, &dbv, 0);
- else unspecified = DBGetContactSettingW(hContact, szModule, szSetting, &dbv);
+ DBVARIANT dbv = { DBVT_DELETED };
+
+ int unspecified;
+ if (szModule == NULL)
+ unspecified = 1;
+ else if (proto_service)
+ unspecified = Proto_GetContactInfoSetting(hContact, szProto, szModule, szSetting, &dbv, 0);
+ else
+ unspecified = DBGetContactSettingW(hContact, szModule, szSetting, &dbv);
+
if ( !unspecified) {
switch(dbv.type) {
- case DBVT_BYTE:
- if (special == SVS_GENDER) {
- if (dbv.cVal == 'M') ptstr = TranslateT("Male");
- else if (dbv.cVal == 'F') ptstr = TranslateT("Female");
- else unspecified = 1;
- }
- else if (special == SVS_MONTH) {
- if (dbv.bVal>0 && dbv.bVal <= 12) {
- pstr = str;
- GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1-1+dbv.bVal, str, SIZEOF(str));
- }
- else unspecified = 1;
- }
- else if (special == SVS_TIMEZONE) {
- if (dbv.cVal == -100) unspecified = 1;
- else {
- pstr = str;
- mir_snprintf(str, SIZEOF(str), dbv.cVal?"UTC%+d:%02d":"UTC", -dbv.cVal/2, (dbv.cVal&1)*30);
- }
+ case DBVT_BYTE:
+ if (special == SVS_GENDER) {
+ if (dbv.cVal == 'M') ptstr = TranslateT("Male");
+ else if (dbv.cVal == 'F') ptstr = TranslateT("Female");
+ else unspecified = 1;
+ }
+ else if (special == SVS_MONTH) {
+ if (dbv.bVal>0 && dbv.bVal <= 12) {
+ pstr = str;
+ GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1-1+dbv.bVal, str, SIZEOF(str));
}
+ else unspecified = 1;
+ }
+ else if (special == SVS_TIMEZONE) {
+ if (dbv.cVal == -100) unspecified = 1;
else {
- unspecified = (special == SVS_ZEROISUNSPEC && dbv.bVal == 0);
- pstr = _itoa(special == SVS_SIGNED?dbv.cVal:dbv.bVal, str, 10);
+ pstr = str;
+ mir_snprintf(str, SIZEOF(str), dbv.cVal?"UTC%+d:%02d":"UTC", -dbv.cVal/2, (dbv.cVal&1)*30);
}
- break;
- case DBVT_WORD:
- if (special == SVS_COUNTRY) {
- WORD wSave = dbv.wVal;
- if (wSave == (WORD)-1) {
- char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sName", szSetting);
- if ( !DBGetContactSettingTString(hContact, szModule, szSettingName, &dbv)) {
- ptstr = dbv.ptszVal;
- unspecified = false;
- break;
- }
- }
+ }
+ else {
+ unspecified = (special == SVS_ZEROISUNSPEC && dbv.bVal == 0);
+ pstr = _itoa(special == SVS_SIGNED?dbv.cVal:dbv.bVal, str, 10);
+ }
+ break;
- pstr = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, wSave, 0));
- unspecified = pstr == NULL;
- }
- else {
- unspecified = (special == SVS_ZEROISUNSPEC && dbv.wVal == 0);
- pstr = _itoa(special == SVS_SIGNED?dbv.sVal:dbv.wVal, str, 10);
- }
- break;
- case DBVT_DWORD:
- unspecified = (special == SVS_ZEROISUNSPEC && dbv.dVal == 0);
- if (special == SVS_IP) {
- struct in_addr ia;
- ia.S_un.S_addr = htonl(dbv.dVal);
- pstr = inet_ntoa(ia);
- if (dbv.dVal == 0) unspecified = 1;
- }
- else pstr = _itoa(special == SVS_SIGNED?dbv.lVal:dbv.dVal, str, 10);
- break;
- case DBVT_ASCIIZ:
- unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
- pstr = dbv.pszVal;
- break;
- case DBVT_UTF8:
- unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
- if ( !unspecified)
- { WCHAR* wszStr;
- Utf8Decode(dbv.pszVal, &wszStr);
- SetDlgItemTextW(hwndDlg, idCtrl, TranslateTS(wszStr));
- mir_free(wszStr);
- goto LBL_Exit;
+ case DBVT_WORD:
+ if (special == SVS_COUNTRY) {
+ WORD wSave = dbv.wVal;
+ if (wSave == (WORD)-1) {
+ char szSettingName[100];
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sName", szSetting);
+ if ( !DBGetContactSettingTString(hContact, szModule, szSettingName, &dbv)) {
+ ptstr = dbv.ptszVal;
+ unspecified = false;
+ break;
+ }
}
-
- pstr = dbv.pszVal;
- Utf8Decode(dbv.pszVal, NULL);
- break;
- default: pstr = str; lstrcpyA(str, "???"); break;
- } }
+
+ pstr = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, wSave, 0));
+ unspecified = pstr == NULL;
+ }
+ else {
+ unspecified = (special == SVS_ZEROISUNSPEC && dbv.wVal == 0);
+ pstr = _itoa(special == SVS_SIGNED?dbv.sVal:dbv.wVal, str, 10);
+ }
+ break;
+
+ case DBVT_DWORD:
+ unspecified = (special == SVS_ZEROISUNSPEC && dbv.dVal == 0);
+ if (special == SVS_IP) {
+ struct in_addr ia;
+ ia.S_un.S_addr = htonl(dbv.dVal);
+ pstr = inet_ntoa(ia);
+ if (dbv.dVal == 0) unspecified = 1;
+ }
+ else pstr = _itoa(special == SVS_SIGNED?dbv.lVal:dbv.dVal, str, 10);
+ break;
+
+ case DBVT_ASCIIZ:
+ unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
+ pstr = dbv.pszVal;
+ break;
+
+ case DBVT_UTF8:
+ unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
+ if ( !unspecified)
+ { WCHAR* wszStr;
+ Utf8Decode(dbv.pszVal, &wszStr);
+ SetDlgItemTextW(hwndDlg, idCtrl, TranslateTS(wszStr));
+ mir_free(wszStr);
+ goto LBL_Exit;
+ }
+
+ pstr = dbv.pszVal;
+ Utf8Decode(dbv.pszVal, NULL);
+ break;
+
+ default:
+ pstr = str;
+ lstrcpyA(str, "???");
+ break;
+ }
+ }
if (unspecified)
SetDlgItemText(hwndDlg, idCtrl, TranslateT("<not specified>"));
@@ -161,9 +174,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule, else
SetDlgItemTextA(hwndDlg, idCtrl, pstr);
-
LBL_Exit:
-
EnableWindow(GetDlgItem(hwndDlg, idCtrl), !unspecified);
if (proto_service)
Proto_FreeInfoVariant(&dbv);
@@ -181,12 +192,13 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_NOTIFY:
switch (((LPNMHDR)lParam)->idFrom) {
case 0:
- if (((LPNMHDR)lParam)->code == PSN_INFOCHANGED)
- { char *szProto;
+ if (((LPNMHDR)lParam)->code == PSN_INFOCHANGED) {
HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
- szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if (szProto == NULL) break;
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ if (szProto == NULL)
+ break;
+
SetValue(hwndDlg, IDC_NICK, hContact, szProto, "Nick", 0);
SetValue(hwndDlg, IDC_FIRSTNAME, hContact, szProto, "FirstName", 0);
SetValue(hwndDlg, IDC_LASTNAME, hContact, szProto, "LastName", 0);
@@ -197,10 +209,12 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetValue(hwndDlg, IDC_DOBMONTH, hContact, szProto, "BirthMonth", SVS_MONTH);
SetValue(hwndDlg, IDC_DOBYEAR, hContact, szProto, "BirthYear", 0);
SetValue(hwndDlg, IDC_MARITAL, hContact, szProto, "MaritalStatus", 0);
- } }
+ }
+ }
break;
}
break;
+
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDCANCEL:
@@ -223,75 +237,72 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- TranslateDialogDefault(hwndDlg);
- SetTimer(hwndDlg, 1, 1000, NULL);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+ TranslateDialogDefault(hwndDlg);
+ SetTimer(hwndDlg, 1, 1000, NULL);
- tmi.prepareList((HANDLE)lParam, GetDlgItem(hwndDlg, IDC_TIMEZONESELECT), TZF_PLF_CB);
- SendMessage(hwndDlg, WM_TIMER, 0, 0);
- break;
+ tmi.prepareList((HANDLE)lParam, GetDlgItem(hwndDlg, IDC_TIMEZONESELECT), TZF_PLF_CB);
+ SendMessage(hwndDlg, WM_TIMER, 0, 0);
+ break;
- case WM_TIMER:
+ case WM_TIMER:
{
HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- if (hContact != NULL)
- {
+ if (hContact != NULL) {
TCHAR szTime[80];
-
- if (tmi.printDateTimeByContact(hContact, _T("s"), szTime, SIZEOF(szTime), TZF_KNOWNONLY))
- {
+ if (tmi.printDateTimeByContact(hContact, _T("s"), szTime, SIZEOF(szTime), TZF_KNOWNONLY)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_LOCALTIME), FALSE);
SetDlgItemText(hwndDlg, IDC_LOCALTIME, TranslateT("<not specified>"));
}
- else
- {
+ else {
EnableWindow(GetDlgItem(hwndDlg, IDC_LOCALTIME), TRUE);
SetDlgItemText(hwndDlg, IDC_LOCALTIME, szTime);
}
}
- break;
}
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- if (((LPNMHDR)lParam)->code == PSN_INFOCHANGED)
- { char *szProto;
- HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam;
- if (hContact != NULL) {
- szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if (szProto == NULL) break;
- SetValue(hwndDlg, IDC_STREET, hContact, szProto, "Street", SVS_ZEROISUNSPEC);
- SetValue(hwndDlg, IDC_CITY, hContact, szProto, "City", SVS_ZEROISUNSPEC);
- SetValue(hwndDlg, IDC_STATE, hContact, szProto, "State", SVS_ZEROISUNSPEC);
- SetValue(hwndDlg, IDC_ZIP, hContact, szProto, "ZIP", SVS_ZEROISUNSPEC);
- SetValue(hwndDlg, IDC_COUNTRY, hContact, szProto, "Country", SVS_COUNTRY);
- SetValue(hwndDlg, IDC_LANGUAGE1, hContact, szProto, "Language1", SVS_ZEROISUNSPEC);
- SetValue(hwndDlg, IDC_LANGUAGE2, hContact, szProto, "Language2", SVS_ZEROISUNSPEC);
- SetValue(hwndDlg, IDC_LANGUAGE3, hContact, szProto, "Language3", SVS_ZEROISUNSPEC);
- SetValue(hwndDlg, IDC_TIMEZONE, hContact, szProto, "Timezone", SVS_TIMEZONE);
- }
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ if (((LPNMHDR)lParam)->code == PSN_INFOCHANGED) {
+ HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam;
+ if (hContact != NULL) {
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ if (szProto == NULL)
+ break;
+
+ SetValue(hwndDlg, IDC_STREET, hContact, szProto, "Street", SVS_ZEROISUNSPEC);
+ SetValue(hwndDlg, IDC_CITY, hContact, szProto, "City", SVS_ZEROISUNSPEC);
+ SetValue(hwndDlg, IDC_STATE, hContact, szProto, "State", SVS_ZEROISUNSPEC);
+ SetValue(hwndDlg, IDC_ZIP, hContact, szProto, "ZIP", SVS_ZEROISUNSPEC);
+ SetValue(hwndDlg, IDC_COUNTRY, hContact, szProto, "Country", SVS_COUNTRY);
+ SetValue(hwndDlg, IDC_LANGUAGE1, hContact, szProto, "Language1", SVS_ZEROISUNSPEC);
+ SetValue(hwndDlg, IDC_LANGUAGE2, hContact, szProto, "Language2", SVS_ZEROISUNSPEC);
+ SetValue(hwndDlg, IDC_LANGUAGE3, hContact, szProto, "Language3", SVS_ZEROISUNSPEC);
+ SetValue(hwndDlg, IDC_TIMEZONE, hContact, szProto, "Timezone", SVS_TIMEZONE);
}
- break;
}
+ }
+ break;
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDCANCEL:
+ SendMessage(GetParent(hwndDlg), msg, wParam, lParam);
break;
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDCANCEL:
- SendMessage(GetParent(hwndDlg), msg, wParam, lParam);
- break;
- case IDC_TIMEZONESELECT:
- if (HIWORD(wParam) == CBN_SELCHANGE) {
- HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- tmi.storeListResults(hContact, GetDlgItem(hwndDlg, IDC_TIMEZONESELECT), TZF_PLF_CB);
- }
- break;
+
+ case IDC_TIMEZONESELECT:
+ if (HIWORD(wParam) == CBN_SELCHANGE) {
+ HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ tmi.storeListResults(hContact, GetDlgItem(hwndDlg, IDC_TIMEZONESELECT), TZF_PLF_CB);
}
- break;
+ }
+ break;
}
return FALSE;
}
@@ -302,40 +313,42 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
break;
+
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- if (((LPNMHDR)lParam)->code == PSN_INFOCHANGED)
- { char *szProto;
- HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam;
- if (hContact != NULL) {
- szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if (szProto == NULL) break;
- SetValue(hwndDlg, IDC_COMPANY, hContact, szProto, "Company", SVS_ZEROISUNSPEC);
- SetValue(hwndDlg, IDC_DEPARTMENT, hContact, szProto, "CompanyDepartment", SVS_ZEROISUNSPEC);
- SetValue(hwndDlg, IDC_POSITION, hContact, szProto, "CompanyPosition", SVS_ZEROISUNSPEC);
- SetValue(hwndDlg, IDC_STREET, hContact, szProto, "CompanyStreet", SVS_ZEROISUNSPEC);
- SetValue(hwndDlg, IDC_CITY, hContact, szProto, "CompanyCity", SVS_ZEROISUNSPEC);
- SetValue(hwndDlg, IDC_STATE, hContact, szProto, "CompanyState", SVS_ZEROISUNSPEC);
- SetValue(hwndDlg, IDC_ZIP, hContact, szProto, "CompanyZIP", SVS_ZEROISUNSPEC);
- SetValue(hwndDlg, IDC_COUNTRY, hContact, szProto, "CompanyCountry", SVS_COUNTRY);
- SetValue(hwndDlg, IDC_WEBPAGE, hContact, szProto, "CompanyHomepage", SVS_ZEROISUNSPEC);
- } }
- break;
+ case 0:
+ if (((LPNMHDR)lParam)->code == PSN_INFOCHANGED) {
+ HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam;
+ if (hContact != NULL) {
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ if (szProto == NULL) break;
+ SetValue(hwndDlg, IDC_COMPANY, hContact, szProto, "Company", SVS_ZEROISUNSPEC);
+ SetValue(hwndDlg, IDC_DEPARTMENT, hContact, szProto, "CompanyDepartment", SVS_ZEROISUNSPEC);
+ SetValue(hwndDlg, IDC_POSITION, hContact, szProto, "CompanyPosition", SVS_ZEROISUNSPEC);
+ SetValue(hwndDlg, IDC_STREET, hContact, szProto, "CompanyStreet", SVS_ZEROISUNSPEC);
+ SetValue(hwndDlg, IDC_CITY, hContact, szProto, "CompanyCity", SVS_ZEROISUNSPEC);
+ SetValue(hwndDlg, IDC_STATE, hContact, szProto, "CompanyState", SVS_ZEROISUNSPEC);
+ SetValue(hwndDlg, IDC_ZIP, hContact, szProto, "CompanyZIP", SVS_ZEROISUNSPEC);
+ SetValue(hwndDlg, IDC_COUNTRY, hContact, szProto, "CompanyCountry", SVS_COUNTRY);
+ SetValue(hwndDlg, IDC_WEBPAGE, hContact, szProto, "CompanyHomepage", SVS_ZEROISUNSPEC);
+ }
+ }
+ break;
}
break;
+
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDCANCEL:
SendMessage(GetParent(hwndDlg), msg, wParam, lParam);
break;
+
case IDC_WEBPAGE:
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_WEBPAGE))) {
char szPage[256];
GetDlgItemTextA(hwndDlg, IDC_WEBPAGE, szPage, SIZEOF(szPage));
CallService(MS_UTILS_OPENURL, 1, (LPARAM)szPage);
}
- break;
}
break;
}
@@ -396,7 +409,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.iItem = 0;
for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), "Past%d", i);
- if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
+ if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
( !proto_service && DBGetContactSettingTString(hContact, szProto, idstr, &dbv)))
break;
mir_snprintf(idstr, SIZEOF(idstr), "Past%dText", i);
@@ -415,7 +428,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), "Affiliation%d", i);
- if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
+ if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
( !proto_service && DBGetContactSettingTString(hContact, szProto, idstr, &dbv)))
break;
mir_snprintf(idstr, SIZEOF(idstr), "Affiliation%dText", i);
@@ -441,7 +454,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.iItem = 0;
for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), "Interest%dCat", i);
- if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
+ if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
( !proto_service && DBGetContactSettingTString(hContact, szProto, idstr, &dbv)))
break;
mir_snprintf(idstr, SIZEOF(idstr), "Interest%dText", i);
@@ -462,6 +475,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, break;
}
break;
+
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDCANCEL:
@@ -504,7 +518,6 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
lstrcpy(lf.lfFaceName, _T("Courier New"));
lf.lfCharSet = DEFAULT_CHARSET;
-// hFont = (HFONT) GetStockObject(ANSI_FIXED_FONT);
hFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hwndDlg, IDC_ABOUT, WM_SETFONT, (WPARAM) hFont, MAKELPARAM(TRUE, 0));
diff --git a/src/core/stduserinfo/userinfo.cpp b/src/core/stduserinfo/userinfo.cpp index 9fe199d5b7..37b7168137 100644 --- a/src/core/stduserinfo/userinfo.cpp +++ b/src/core/stduserinfo/userinfo.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-2009 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -44,7 +44,7 @@ struct DetailsPageData LPARAM dlgParam;
HWND hwnd;
HTREEITEM hItem;
- int changed;
+ int changed, hLangpack;
TCHAR *ptszTitle, *ptszTab;
};
@@ -63,18 +63,32 @@ struct DetailsData int *infosUpdated;
};
+TCHAR* getTitle(OPTIONSDIALOGPAGE *p)
+{
+ return (p->flags & ODPF_DONTTRANSLATE) ? p->ptszTitle : TranslateTH(p->hLangpack, p->ptszTitle);
+}
+
+TCHAR* getTab(OPTIONSDIALOGPAGE *p)
+{
+ return (p->flags & ODPF_DONTTRANSLATE) ? p->ptszTab : TranslateTH(p->hLangpack, p->ptszTab);
+}
+
static int PageSortProc(OPTIONSDIALOGPAGE *item1, OPTIONSDIALOGPAGE *item2)
{
int res;
- if ( !lstrcmp(item1->ptszTitle, TranslateT("Summary"))) return -1;
- if ( !lstrcmp(item2->ptszTitle, TranslateT("Summary"))) return 1;
- if (res = lstrcmp(item1->ptszTitle, item2->ptszTitle)) return res;
- if (item1->ptszTab && !item2->ptszTab) return -1;
- if ( !item1->ptszTab && item2->ptszTab) return 1;
- if ( !item1->ptszTab && !item2->ptszTab) return 0;
- if (item1->ptszTab && !lstrcmp(item1->ptszTab, TranslateT("General"))) return -1;
- if (item2->ptszTab && !lstrcmp(item2->ptszTab, TranslateT("General"))) return 1;
- return lstrcmp(item1->ptszTab, item2->ptszTab);
+ TCHAR *s1 = getTitle(item1), *s2 = getTitle(item2);
+ if ( !lstrcmp(s1, TranslateT("Summary"))) return -1;
+ if ( !lstrcmp(s2, TranslateT("Summary"))) return 1;
+ if (res = lstrcmp(s1, s2)) return res;
+
+ s1 = getTab(item1), getTab(item2);
+ if (s1 && !s2) return -1;
+ if (!s1 && s2) return 1;
+ if (!s1 && !s2) return 0;
+
+ if (s1 && !lstrcmp(s1, TranslateT("General"))) return -1;
+ if (s2 && !lstrcmp(s2, TranslateT("General"))) return 1;
+ return lstrcmp(s1, s2);
}
static INT_PTR ShowDetailsDialogCommand(WPARAM wParam, LPARAM)
@@ -132,25 +146,22 @@ static INT_PTR AddDetailsPage(WPARAM wParam, LPARAM lParam) dst->pfnDlgProc = odp->pfnDlgProc;
dst->position = odp->position;
dst->pszTemplate = ((DWORD_PTR)odp->pszTemplate & 0xFFFF0000) ? mir_strdup(odp->pszTemplate) : odp->pszTemplate;
-
+
if (odp->flags & ODPF_UNICODE) {
dst->ptszTitle = (odp->ptszTitle == 0) ? NULL : mir_wstrdup(odp->ptszTitle);
dst->ptszTab = ( !(odp->flags & ODPF_USERINFOTAB) || !odp->ptszTab) ? NULL : mir_wstrdup(odp->ptszTab);
}
else {
- if (odp->flags & ODPF_DONTTRANSLATE)
- dst->ptszTitle = (odp->pszTitle == 0) ? NULL : mir_a2t(odp->pszTitle);
- else
- dst->ptszTitle = (odp->pszTitle == 0) ? NULL : Langpack_PcharToTchar(odp->pszTitle);
- dst->ptszTab = ( !(odp->flags & ODPF_USERINFOTAB) || !odp->pszTab) ? NULL : Langpack_PcharToTchar(odp->pszTab);
+ dst->ptszTitle = mir_a2t(odp->pszTitle);
+ dst->ptszTab = ( !(odp->flags & ODPF_USERINFOTAB) || !odp->pszTab) ? NULL : mir_a2t(odp->pszTab);
}
+ dst->hLangpack = odp->hLangpack;
dst->flags = odp->flags;
dst->groupPosition = odp->groupPosition;
dst->hGroupIcon = odp->hGroupIcon;
dst->hIcon = odp->hIcon;
- if (odp->cbSize == sizeof(OPTIONSDIALOGPAGE))
- dst->dwInitParam = odp->dwInitParam;
+ dst->dwInitParam = odp->dwInitParam;
opi->pageCount++;
return 0;
}
@@ -170,13 +181,14 @@ static void CreateDetailsTabs(HWND hwndDlg, DetailsData *dat, DetailsPageData *p tie.iImage = -1;
TabCtrl_DeleteAllItems(hwndTab);
for (int i=0; i < dat->pageCount; i++) {
- if ( !dat->opd[i].ptszTab || lstrcmp(dat->opd[i].ptszTitle, ppg->ptszTitle))
+ DetailsPageData &odp = dat->opd[i];
+ if ( !odp.ptszTab || lstrcmp(odp.ptszTitle, ppg->ptszTitle))
continue;
- tie.pszText = TranslateTS(dat->opd[i].ptszTab);
+ tie.pszText = TranslateTH(odp.hLangpack, odp.ptszTab);
tie.lParam = i;
TabCtrl_InsertItem(hwndTab, pages, &tie);
- if ( !lstrcmp(dat->opd[i].ptszTab, ppg->ptszTab))
+ if ( !lstrcmp(odp.ptszTab, ppg->ptszTab))
sel = pages;
pages++;
}
@@ -222,7 +234,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
PSHNOTIFY pshn;
int i;
-
+
DetailsData *dat = (DetailsData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
@@ -251,7 +263,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetDlgItemText(hwndDlg, IDC_HEADERBAR, oldTitle, SIZEOF(oldTitle));
mir_sntprintf(newTitle, SIZEOF(newTitle), oldTitle, name);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, newTitle);
-
+
//////////////////////////////////////////////////////////////////////
LOGFONT lf;
HFONT hNormalFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_NAME, WM_GETFONT, 0, 0);
@@ -276,17 +288,19 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP //////////////////////////////////////////////////////////////////////
HWND hwndTree = GetDlgItem(hwndDlg, IDC_PAGETREE);
for (i=0; i < dat->pageCount; i++) {
- dat->opd[i].pTemplate = (LPDLGTEMPLATE)LockResource(LoadResource(odp[i].hInstance,
+ DetailsPageData &p = dat->opd[i];
+ p.pTemplate = (LPDLGTEMPLATE)LockResource(LoadResource(odp[i].hInstance,
FindResourceA(odp[i].hInstance, odp[i].pszTemplate, MAKEINTRESOURCEA(5))));
- dat->opd[i].dlgProc = odp[i].pfnDlgProc;
- dat->opd[i].dlgParam = odp[i].dwInitParam;
- dat->opd[i].hInst = odp[i].hInstance;
+ p.dlgProc = odp[i].pfnDlgProc;
+ p.dlgParam = odp[i].dwInitParam;
+ p.hInst = odp[i].hInstance;
- dat->opd[i].ptszTitle = odp[i].ptszTitle;
- dat->opd[i].ptszTab = odp[i].ptszTab;
+ p.ptszTitle = odp[i].ptszTitle;
+ p.ptszTab = odp[i].ptszTab;
+ p.hLangpack = odp[i].hLangpack;
- if (i && dat->opd[i].ptszTab && !lstrcmp(dat->opd[i-1].ptszTitle, dat->opd[i].ptszTitle)) {
- dat->opd[i].hItem = dat->opd[i-1].hItem;
+ if (i && p.ptszTab && !lstrcmp(dat->opd[i-1].ptszTitle, p.ptszTitle)) {
+ p.hItem = dat->opd[i-1].hItem;
continue;
}
@@ -296,12 +310,12 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP tvis.item.mask = TVIF_TEXT | TVIF_PARAM;
tvis.item.lParam = (LPARAM) i;
if (odp[i].flags & ODPF_DONTTRANSLATE)
- tvis.item.pszText = mir_tstrdup(odp[i].ptszTitle);
+ tvis.item.pszText = p.ptszTitle;
else
- tvis.item.pszText = TranslateTS(odp[i].ptszTitle);
+ tvis.item.pszText = TranslateTH(p.hLangpack, p.ptszTitle);
if (ptszLastTab && !lstrcmp(tvis.item.pszText, ptszLastTab))
dat->currentPage = i;
- dat->opd[i].hItem = TreeView_InsertItem(hwndTree, &tvis);
+ p.hItem = TreeView_InsertItem(hwndTree, &tvis);
}
//////////////////////////////////////////////////////////////////////
@@ -315,7 +329,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetWindowRect(hwndTab, &dat->rcDisplayTab);
TabCtrl_AdjustRect(hwndTab, FALSE, &dat->rcDisplayTab);
-
+
POINT pt = {0, 0};
ClientToScreen(hwndDlg, &pt);
OffsetRect(&dat->rcDisplayTab, -pt.x, -pt.y);
@@ -324,7 +338,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetWindowRect(hwndTab, &dat->rcDisplay);
TabCtrl_AdjustRect(hwndTab, FALSE, &dat->rcDisplay);
-
+
memset(&pt, 0, sizeof(pt));
ClientToScreen(hwndDlg, &pt);
OffsetRect(&dat->rcDisplay, -pt.x, -pt.y);
@@ -366,8 +380,8 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP COLORREF textCol = GetSysColor(COLOR_BTNTEXT);
COLORREF bgCol = GetSysColor(COLOR_3DFACE);
int ratio = abs(UPDATEANIMFRAMES/2-dat->updateAnimFrame)*510/UPDATEANIMFRAMES;
- COLORREF newCol = RGB(GetRValue(bgCol)+(GetRValue(textCol)-GetRValue(bgCol))*ratio/256,
- GetGValue(bgCol)+(GetGValue(textCol)-GetGValue(bgCol))*ratio/256,
+ COLORREF newCol = RGB(GetRValue(bgCol)+(GetRValue(textCol)-GetRValue(bgCol))*ratio/256,
+ GetGValue(bgCol)+(GetGValue(textCol)-GetGValue(bgCol))*ratio/256,
GetBValue(bgCol)+(GetBValue(textCol)-GetBValue(bgCol))*ratio/256);
SetTextColor((HDC)wParam, newCol);
SetBkColor((HDC)wParam, GetSysColor(COLOR_3DFACE));
@@ -389,9 +403,10 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP pshn.hdr.idFrom = 0;
pshn.lParam = (LPARAM)dat->hContact;
for (i=0; i < dat->pageCount; i++) {
- pshn.hdr.hwndFrom = dat->opd[i].hwnd;
- if (dat->opd[i].hwnd != NULL)
- SendMessage(dat->opd[i].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
+ DetailsPageData &odp = dat->opd[i];
+ pshn.hdr.hwndFrom = odp.hwnd;
+ if (odp.hwnd != NULL)
+ SendMessage(odp.hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
}
break;
@@ -511,17 +526,19 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch(LOWORD(wParam)) {
case IDCANCEL:
pshn.hdr.idFrom = 0;
- pshn.lParam = (LPARAM)dat->hContact;
pshn.hdr.code = PSN_RESET;
+ pshn.lParam = (LPARAM)dat->hContact;
for (i=0; i < dat->pageCount; i++) {
- if (dat->opd[i].hwnd == NULL || !dat->opd[i].changed) continue;
- pshn.hdr.hwndFrom = dat->opd[i].hwnd;
- SendMessage(dat->opd[i].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
+ DetailsPageData &odp = dat->opd[i];
+ if (odp.hwnd == NULL || !odp.changed)
+ continue;
+ pshn.hdr.hwndFrom = odp.hwnd;
+ SendMessage(odp.hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
}
DestroyWindow(hwndDlg);
break;
-
+
case IDOK:
pshn.hdr.idFrom = 0;
pshn.lParam = (LPARAM)dat->hContact;
@@ -534,10 +551,12 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP pshn.hdr.code = PSN_APPLY;
for (i=0; i < dat->pageCount;i++) {
- if (dat->opd[i].hwnd == NULL || !dat->opd[i].changed) continue;
- pshn.hdr.hwndFrom = dat->opd[i].hwnd;
- if (SendMessage(dat->opd[i].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn) == PSNRET_INVALID_NOCHANGEPAGE) {
- TreeView_Select(GetDlgItem(hwndDlg, IDC_PAGETREE), dat->opd[i].hItem, TVGN_CARET);
+ DetailsPageData &odp = dat->opd[i];
+ if (odp.hwnd == NULL || !odp.changed)
+ continue;
+ pshn.hdr.hwndFrom = odp.hwnd;
+ if (SendMessage(odp.hwnd, WM_NOTIFY, 0, (LPARAM)&pshn) == PSNRET_INVALID_NOCHANGEPAGE) {
+ TreeView_Select(GetDlgItem(hwndDlg, IDC_PAGETREE), odp.hItem, TVGN_CARET);
if (dat->currentPage != -1) ShowWindow(dat->opd[dat->currentPage].hwnd, SW_HIDE);
dat->currentPage = i;
ShowWindow(dat->opd[dat->currentPage].hwnd, SW_SHOW);
@@ -584,9 +603,11 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP UnhookEvent(dat->hProtoAckEvent);
for (i=0; i < dat->pageCount; i++) {
- if (dat->opd[i].hwnd != NULL) DestroyWindow(dat->opd[i].hwnd);
- mir_free(dat->opd[i].ptszTitle);
- mir_free(dat->opd[i].ptszTab);
+ DetailsPageData &odp = dat->opd[i];
+ if (odp.hwnd != NULL)
+ DestroyWindow(odp.hwnd);
+ mir_free(odp.ptszTitle);
+ mir_free(odp.ptszTab);
}
mir_free(dat->infosUpdated);
|