From 46d9640d6255be95f73a9fbc89f50c702928a241 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 22 Sep 2022 20:47:12 +0300 Subject: =?UTF-8?q?fixes=20#3201=20(Jabber:=20=D0=BD=D0=B5=20=D1=83=D0=B4?= =?UTF-8?q?=D0=B0=D1=91=D1=82=D1=81=D1=8F=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=82=D1=8C=20=D1=84=D0=BE=D1=82=D0=BE)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/JabberG/src/jabber_userinfo.cpp | 11 ++++------- protocols/JabberG/src/jabber_vcard.cpp | 14 ++++++++------ 2 files changed, 12 insertions(+), 13 deletions(-) (limited to 'protocols/JabberG/src') diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index fc7ddf22c7..595a0c663a 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -524,7 +524,7 @@ class JabberUserPhotoDlg : public JabberBaseUserInfoDlg { HBITMAP hBitmap = nullptr; - CCtrlButton btnSave; + CCtrlMButton btnSave; UI_MESSAGE_MAP(JabberUserInfoDlg, JabberBaseUserInfoDlg); UI_MESSAGE(WM_PAINT, OnPaint); @@ -547,14 +547,13 @@ class JabberUserPhotoDlg : public JabberBaseUserInfoDlg public: JabberUserPhotoDlg(CJabberProto *_ppro) : JabberBaseUserInfoDlg(_ppro, IDD_VCARD_PHOTO), - btnSave(this, IDC_SAVE) + btnSave(this, IDC_SAVE, g_plugin.getIcon(IDI_SAVE), LPGEN("Save")) { btnSave.OnClick = Callback(this, &JabberUserPhotoDlg::onClick_Save); } bool OnInitDialog() override { - Button_SetIcon_IcoLib(m_hwnd, IDC_SAVE, g_plugin.getIconHandle(IDI_SAVE)); ShowWindow(GetDlgItem(m_hwnd, IDC_LOAD), SW_HIDE); ShowWindow(GetDlgItem(m_hwnd, IDC_DELETE), SW_HIDE); return true; @@ -562,8 +561,6 @@ public: void OnDestroy() override { - Button_FreeIcon_IcoLib(m_hwnd, IDC_SAVE); - if (hBitmap) { ppro->debugLogA("Delete bitmap"); DeleteObject(hBitmap); @@ -581,14 +578,14 @@ public: DeleteObject(hBitmap); hBitmap = nullptr; } - ShowWindow(GetDlgItem(m_hwnd, IDC_SAVE), SW_HIDE); + btnSave.Hide(); char *pszFileName = GetFileName(); if (mir_strlen(pszFileName)) { ppro->debugLogA("Showing picture from %s", pszFileName); hBitmap = Bitmap_Load(Utf2T(pszFileName)); FreeImage_Premultiply(hBitmap); - ShowWindow(GetDlgItem(m_hwnd, IDC_SAVE), SW_SHOW); + btnSave.Show(); } InvalidateRect(m_hwnd, nullptr, TRUE); diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index 57f4a4b28d..fea9f7b7e9 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -214,6 +214,7 @@ struct JabberVcardWorkDlg : public JabberVcardBaseDlg class JabberVcardPhotoDlg : public JabberVcardBaseDlg { HBITMAP hBitmap; + CCtrlMButton btnLoad, btnDelete; UI_MESSAGE_MAP(JabberVcardPhotoDlg, JabberVcardBaseDlg); UI_MESSAGE(WM_PAINT, OnPaint); @@ -221,16 +222,18 @@ class JabberVcardPhotoDlg : public JabberVcardBaseDlg public: JabberVcardPhotoDlg(CJabberProto *_ppro) : - JabberVcardBaseDlg(_ppro, IDD_VCARD_PHOTO, 3) + JabberVcardBaseDlg(_ppro, IDD_VCARD_PHOTO, 3), + btnLoad(this, IDC_LOAD, g_plugin.getIcon(IDI_OPEN), LPGEN("Load")), + btnDelete(this, IDC_DELETE, g_plugin.getIcon(IDI_DELETE), LPGEN("Delete")) { + btnLoad.OnClick = Callback(this, &JabberVcardPhotoDlg::onClick_Load); + btnDelete.OnClick = Callback(this, &JabberVcardPhotoDlg::onClick_Delete); } bool OnInitDialog() override { JabberVcardBaseDlg::OnInitDialog(); - Button_SetIcon_IcoLib(m_hwnd, IDC_LOAD, g_plugin.getIconHandle(IDI_OPEN)); - Button_SetIcon_IcoLib(m_hwnd, IDC_DELETE, g_plugin.getIconHandle(IDI_DELETE)); ShowWindow(GetDlgItem(m_hwnd, IDC_SAVE), SW_HIDE); ppro->m_bPhotoChanged = false; @@ -241,8 +244,6 @@ public: { JabberVcardBaseDlg::OnDestroy(); - Button_FreeIcon_IcoLib(m_hwnd, IDC_LOAD); - Button_FreeIcon_IcoLib(m_hwnd, IDC_DELETE); if (hBitmap) { ppro->debugLogA("Delete bitmap"); DeleteObject(hBitmap); @@ -358,7 +359,6 @@ public: if (hBitmap == nullptr) return FALSE; - BITMAP bm; POINT ptSize, ptOrg, pt, ptFitSize; RECT rect; @@ -367,6 +367,8 @@ public: HDC hdcMem = CreateCompatibleDC(hdcCanvas); SelectObject(hdcMem, hBitmap); SetMapMode(hdcMem, GetMapMode(hdcCanvas)); + + BITMAP bm; GetObject(hBitmap, sizeof(BITMAP), (LPVOID)&bm); ptSize.x = bm.bmWidth; ptSize.y = bm.bmHeight; -- cgit v1.2.3