diff options
author | George Hazan <george.hazan@gmail.com> | 2024-02-19 20:28:51 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-02-19 20:31:13 +0300 |
commit | 7b2016dd3679ffc8f47a138348cd2e63bcc4b69e (patch) | |
tree | e1127a3f6f960dfca046e0be445c49c43190d6be | |
parent | dad78af87b3c110d07ef6928d1b8b34754767a3e (diff) |
StdUserInfo: enhanced look-n-feel of the Summary page
-rw-r--r-- | src/core/stduserinfo/res/resource.rc | 40 | ||||
-rw-r--r-- | src/core/stduserinfo/src/resource.h | 9 | ||||
-rw-r--r-- | src/core/stduserinfo/src/stdafx.h | 1 | ||||
-rw-r--r-- | src/core/stduserinfo/src/stdinfo.cpp | 53 | ||||
-rw-r--r-- | src/core/stduserinfo/src/utils.h | 2 |
5 files changed, 83 insertions, 22 deletions
diff --git a/src/core/stduserinfo/res/resource.rc b/src/core/stduserinfo/res/resource.rc index 3ccd9bebd4..e38dfb5c83 100644 --- a/src/core/stduserinfo/res/resource.rc +++ b/src/core/stduserinfo/res/resource.rc @@ -94,24 +94,28 @@ STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CONTROL | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- LTEXT "Nickname:",IDC_STATIC,5,5,46,8
- EDITTEXT IDC_NICK,51,5,166,8,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
- LTEXT "First name:",IDC_STATIC,5,18,46,8
- EDITTEXT IDC_FIRSTNAME,51,18,74,8,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
- LTEXT "Gender:",IDC_STATIC,126,18,44,8
- EDITTEXT IDC_GENDER,170,18,47,8,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
- LTEXT "Last name:",IDC_STATIC,5,31,46,8
- EDITTEXT IDC_LASTNAME,51,31,74,8,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
- LTEXT "Age:",IDC_STATIC,126,31,44,8
- EDITTEXT IDC_AGE,170,31,47,8,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
- LTEXT "E-mail:",IDC_STATIC,5,44,46,8
- CONTROL "",IDC_EMAIL,"Hyperlink",WS_TABSTOP,51,44,166,8
- LTEXT "Date of birth:",IDC_STATIC,5,58,59,8
- EDITTEXT IDC_DOBDAY,66,58,8,8,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
- EDITTEXT IDC_DOBMONTH,76,58,16,8,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
- EDITTEXT IDC_DOBYEAR,94,58,20,8,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
- LTEXT "Marital status:",IDC_STATIC,5,71,76,8
- EDITTEXT IDC_MARITAL,83,71,87,8,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ EDITTEXT IDC_NICK,74,0,146,8,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ LTEXT "First name:",IDC_STATIC,0,72,46,8
+ EDITTEXT IDC_FIRSTNAME,48,72,74,8,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ LTEXT "Gender:",IDC_STATIC,126,72,44,8
+ EDITTEXT IDC_GENDER,168,72,53,8,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ LTEXT "Last name:",IDC_STATIC,0,84,46,8
+ EDITTEXT IDC_LASTNAME,48,84,74,8,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ LTEXT "Age:",IDC_STATIC,126,84,44,8
+ EDITTEXT IDC_AGE,168,84,53,8,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ LTEXT "E-mail:",IDC_STATIC,0,96,46,8
+ CONTROL "",IDC_EMAIL,"Hyperlink",WS_TABSTOP,49,96,160,8
+ LTEXT "Date of birth:",IDC_STATIC,0,108,59,8
+ EDITTEXT IDC_DOBDAY,78,108,8,8,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ EDITTEXT IDC_DOBMONTH,96,108,16,8,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ EDITTEXT IDC_DOBYEAR,114,108,20,8,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ LTEXT "Marital status:",IDC_STATIC,0,120,76,8
+ EDITTEXT IDC_MARITAL,76,120,87,8,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ CONTROL "",IDC_AVA,"MAvatarControlClass",WS_TABSTOP,0,0,66,60
+ EDITTEXT IDC_ADDR,72,12,124,8,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ PUSHBUTTON "Copy",IDC_CPADDR,197,10,24,12,BS_ICON
+ EDITTEXT IDC_FN,72,24,146,8,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ CONTROL "",IDC_HORLINE,"Static",SS_ETCHEDHORZ,0,66,221,1
END
IDD_INFO_CONTACT DIALOGEX 0, 0, 222, 132
diff --git a/src/core/stduserinfo/src/resource.h b/src/core/stduserinfo/src/resource.h index 463916e326..a2eb8ce824 100644 --- a/src/core/stduserinfo/src/resource.h +++ b/src/core/stduserinfo/src/resource.h @@ -20,8 +20,10 @@ #define IDD_INFO_WORK 115 #define IDI_LOCATION 116 #define IDC_COUNTRY 1001 +#define IDC_CPADDR 1001 #define IDC_AREA 1002 #define IDC_NUMBER 1003 +#define IDC_AVA 1003 #define IDC_PHONE 1004 #define IDC_EMAIL 1005 #define IDC_HEADERBAR 1006 @@ -35,11 +37,13 @@ #define IDC_LASTNAME 1014 #define IDC_AGE 1015 #define IDC_SMS 1016 +#define IDC_ADDR 1016 #define IDC_DOBDAY 1017 #define IDC_DOBMONTH 1018 #define IDC_DOBYEAR 1019 #define IDC_MARITAL 1020 #define IDC_EMAILS 1021 +#define IDC_FN 1021 #define IDC_PHONES 1022 #define IDC_WEBPAGE 1023 #define IDC_PAST 1024 @@ -59,14 +63,15 @@ #define IDC_COMPANY 1038 #define IDC_DEPARTMENT 1039 #define IDC_POSITION 1040 +#define IDC_HORLINE 1041 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_RESOURCE_VALUE 102 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_CONTROL_VALUE 1004 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/src/core/stduserinfo/src/stdafx.h b/src/core/stduserinfo/src/stdafx.h index 0b5da51dfa..e11eb44fef 100644 --- a/src/core/stduserinfo/src/stdafx.h +++ b/src/core/stduserinfo/src/stdafx.h @@ -64,6 +64,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_timezones.h>
#include <m_toptoolbar.h>
#include <m_userinfo.h>
+#include <m_acc.h>
#include "version.h"
diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp index 3392fb341b..9cd1fad10c 100644 --- a/src/core/stduserinfo/src/stdinfo.cpp +++ b/src/core/stduserinfo/src/stdinfo.cpp @@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Summary dlg page
static DataItem itemsSummary1[] = {
+ { "FullName", IDC_FN, 0 },
{ "Nick", IDC_NICK, 0 },
{ "FirstName", IDC_FIRSTNAME, 0 },
{ "LastName", IDC_LASTNAME, 0 },
@@ -47,13 +48,38 @@ static DataItem itemsSummary2[] = { class CSummaryDlg : public CUserInfoPageDlg
{
CCtrlHyperlink m_email;
+ CCtrlButton m_btnCopy;
+ HFONT m_nickfont;
public:
CSummaryDlg() :
CUserInfoPageDlg(g_plugin, IDD_INFO_SUMMARY),
- m_email(this, IDC_EMAIL)
+ m_email(this, IDC_EMAIL),
+ m_btnCopy(this, IDC_CPADDR)
{
m_email.OnClick = Callback(this, &CSummaryDlg::onClick_Email);
+ m_btnCopy.OnClick = Callback(this, &CSummaryDlg::onClick_cpAddr);
+ }
+
+ bool OnInitDialog()
+ {
+ LOGFONT lf;
+ HFONT hf = (HFONT)SendDlgItemMessage(m_hwnd, IDC_NICK, WM_GETFONT, 0, 0);
+ GetObject(hf, sizeof(LOGFONT), &lf);
+ lf.lfWeight = FW_BOLD;
+ m_nickfont = CreateFontIndirect(&lf);
+ SendDlgItemMessage(m_hwnd, IDC_NICK, WM_SETFONT, (WPARAM)m_nickfont, 0);
+
+ SendDlgItemMessage(m_hwnd, IDC_AVA, AVATAR_SETCONTACT, 0, m_hContact);
+ SendDlgItemMessage(m_hwnd, IDC_AVA, AVATAR_SETNOAVATARTEXT, 0, (WPARAM)TranslateT("No avatar"));
+ SendDlgItemMessage(m_hwnd, IDC_AVA, AVATAR_SETAVATARBORDERCOLOR, 0, 0);
+
+ return true;
+ }
+
+ void OnDestroy() override
+ {
+ DeleteObject(m_nickfont);
}
bool IsEmpty() const override
@@ -72,6 +98,9 @@ public: if (szProto == nullptr)
return false;
+ ptrW adr(db_get_wsa(m_hContact, szProto, Proto_GetUniqueId(szProto)));
+ if(adr)
+ SetDlgItemTextW(m_hwnd, IDC_ADDR, adr);
SetValue(m_hwnd, m_hContact, itemsSummary1);
const char *szModule = (-1 == db_get_dw(m_hContact, "UserInfo", "BirthDay", -1)) ? szProto : "UserInfo";
@@ -87,6 +116,28 @@ public: ShellExecute(m_hwnd, L"open", szExec, NULL, NULL, SW_SHOW);
}
}
+
+ void onClick_cpAddr(CCtrlButton *)
+ {
+ wchar_t buf[1024];
+ if (GetDlgItemText(m_hwnd, IDC_ADDR, buf, _countof(buf)))
+ Utils_ClipboardCopy(buf);
+ }
+
+ int Resizer(UTILRESIZECONTROL *urc) override
+ {
+ switch (urc->wId) {
+ case IDC_CPADDR:
+ return RD_ANCHORX_RIGHT | RD_ANCHORY_TOP;
+ case IDC_FN:
+ case IDC_ADDR:
+ case IDC_NICK:
+ case IDC_HORLINE:
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_TOP;
+ }
+
+ return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
+ }
};
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/stduserinfo/src/utils.h b/src/core/stduserinfo/src/utils.h index 92be88a1f5..17be36bc91 100644 --- a/src/core/stduserinfo/src/utils.h +++ b/src/core/stduserinfo/src/utils.h @@ -201,7 +201,7 @@ void SetValue(HWND hwndDlg, MCONTACT hContact, DataItem(&buffer)[_Size], const c }
if (unspecified)
- SetDlgItemText(hwndDlg, it.idCtrl, TranslateT("<not specified>"));
+ (void)0;// SetDlgItemText(hwndDlg, it.idCtrl, TranslateT("<not specified>"));
else if (pwstr != nullptr)
SetDlgItemText(hwndDlg, it.idCtrl, pwstr);
else
|