summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-09-22 20:47:12 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-09-22 20:47:12 +0300
commit46d9640d6255be95f73a9fbc89f50c702928a241 (patch)
treef92756c5c960a74870ff2f2549638aabf851d54c /protocols/JabberG/src
parente17c8fdc71445640b280eaf5bc02a0ac26c640a7 (diff)
fixes #3201 (Jabber: не удаётся изменить фото)
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r--protocols/JabberG/src/jabber_userinfo.cpp11
-rw-r--r--protocols/JabberG/src/jabber_vcard.cpp14
2 files changed, 12 insertions, 13 deletions
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;