From 70ff82fd507835546c5f9a54e593f8868ab50891 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 11 Feb 2023 14:00:31 +0300 Subject: code cleaning --- src/core/stdfile/res/resource.rc | 4 ++-- src/core/stdfile/src/filerecvdlg.cpp | 24 ++++++++++-------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/core/stdfile/res/resource.rc b/src/core/stdfile/res/resource.rc index 28dba7a490..07757af809 100644 --- a/src/core/stdfile/res/resource.rc +++ b/src/core/stdfile/res/resource.rc @@ -45,7 +45,7 @@ BEGIN CONTROL "&User menu",IDC_USERMENU,"MButtonClass",WS_TABSTOP,195,5,16,14,WS_EX_NOACTIVATE | 0x10000000L CONTROL "User &details",IDC_DETAILS,"MButtonClass",WS_TABSTOP,213,5,16,14,WS_EX_NOACTIVATE | 0x10000000L CONTROL "&History",IDC_HISTORY,"MButtonClass",WS_TABSTOP,231,5,16,14,WS_EX_NOACTIVATE | 0x10000000L - CONTROL "",IDC_PROTOCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,5,7,12,12 + CONTROL "",IDC_PROTOCOL,"MButtonClass",WS_TABSTOP,5,7,12,12 LTEXT "",IDC_NAME,19,7,151,9,SS_NOPREFIX | SS_CENTERIMAGE END @@ -72,7 +72,7 @@ BEGIN CONTROL "&User menu",IDC_USERMENU,"MButtonClass",WS_TABSTOP,195,5,16,14,WS_EX_NOACTIVATE | 0x10000000L CONTROL "User &details",IDC_DETAILS,"MButtonClass",WS_TABSTOP,213,5,16,14,WS_EX_NOACTIVATE | 0x10000000L CONTROL "&History",IDC_HISTORY,"MButtonClass",WS_TABSTOP,231,5,16,14,WS_EX_NOACTIVATE | 0x10000000L - CONTROL "",IDC_PROTOCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,5,7,12,12 + CONTROL "",IDC_PROTOCOL,"MButtonClass",WS_TABSTOP,5,7,12,12 LTEXT "",IDC_NAME,19,7,151,9,SS_NOPREFIX | SS_CENTERIMAGE END diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index 8a0b0fd0dc..614c1e24ad 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -181,17 +181,18 @@ class CRecvFileDlg : public CDlgBase FileDlgData *dat; LPARAM m_lParam; - CCtrlButton btnCancel, btnBrowse, btnAdd, btnUserMenu, btnDetails, btnHistory; + CCtrlButton btnCancel, btnBrowse; + CCtrlMButton btnAdd, btnUserMenu, btnDetails, btnHistory; public: CRecvFileDlg(CLISTEVENT *cle) : CDlgBase(g_plugin, IDD_FILERECV), - btnAdd(this, IDC_ADD), + btnAdd(this, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGEN("Add contact permanently to list")), btnCancel(this, IDCANCEL), btnBrowse(this, IDC_FILEDIRBROWSE), - btnDetails(this, IDC_DETAILS), - btnHistory(this, IDC_HISTORY), - btnUserMenu(this, IDC_USERMENU) + btnDetails(this, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View user's details")), + btnHistory(this, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGEN("View user's history")), + btnUserMenu(this, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGEN("User menu")) { dat = new FileDlgData(); dat->hContact = cle->hContact; @@ -209,6 +210,8 @@ public: bool OnInitDialog() override { + char *szProto = Proto_GetBaseAccountName(dat->hContact); + dat->hNotifyEvent = HookEventMessage(ME_PROTO_ACK, m_hwnd, HM_RECVEVENT); dat->hPreshutdownEvent = HookEventMessage(ME_SYSTEM_PRESHUTDOWN, m_hwnd, M_PRESHUTDOWN); @@ -217,10 +220,7 @@ public: EnumChildWindows(m_hwnd, ClipSiblingsChildEnumProc, 0); Window_SetSkinIcon_IcoLib(m_hwnd, SKINICON_EVENT_FILE); - Button_SetSkin_IcoLib(m_hwnd, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGEN("Add contact permanently to list")); - Button_SetSkin_IcoLib(m_hwnd, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View user's details")); - Button_SetSkin_IcoLib(m_hwnd, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGEN("View user's history")); - Button_SetSkin_IcoLib(m_hwnd, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGEN("User menu")); + Button_SetIcon_IcoLib(m_hwnd, IDC_PROTOCOL, Skin_GetProtoIcon(szProto, ID_STATUS_ONLINE)); wchar_t *contactName = Clist_GetContactDisplayName(dat->hContact); SetDlgItemText(m_hwnd, IDC_FROM, contactName); @@ -327,10 +327,6 @@ public: void OnDestroy() override { Window_FreeIcon_IcoLib(m_hwnd); - Button_FreeIcon_IcoLib(m_hwnd, IDC_ADD); - Button_FreeIcon_IcoLib(m_hwnd, IDC_DETAILS); - Button_FreeIcon_IcoLib(m_hwnd, IDC_HISTORY); - Button_FreeIcon_IcoLib(m_hwnd, IDC_USERMENU); delete dat; SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0); @@ -358,7 +354,7 @@ public: FlashWindow(m_hwnd, TRUE); } else if (ack->result != ACKRESULT_FILERESUME) { - SendMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(IDCANCEL, 0), (LPARAM)GetDlgItem(m_hwnd, IDCANCEL)); + btnCancel.Click(); } break; } -- cgit v1.2.3