diff options
author | George Hazan <george.hazan@gmail.com> | 2023-09-05 16:03:58 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-09-05 16:03:58 +0300 |
commit | 64c2fb8c4329d430a4894f154b47269693e31102 (patch) | |
tree | 01963e859043e822306b98308983ab31e9606bfe | |
parent | 28c2eb96831f1e6088e4b498f8125b050585dd3b (diff) |
CSrmmBaseDialog::SetMessageText - move all low-level stuff inside a function
-rw-r--r-- | include/m_srmm_int.h | 1 | ||||
-rw-r--r-- | libs/win32/mir_app.lib | bin | 270570 -> 270920 bytes | |||
-rw-r--r-- | libs/win64/mir_app.lib | bin | 269710 -> 270070 bytes | |||
-rw-r--r-- | plugins/Scriver/src/infobar.cpp | 6 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 15 | ||||
-rw-r--r-- | plugins/Scriver/src/msgtimedout.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 6 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/srmm_base.cpp | 11 |
10 files changed, 23 insertions, 22 deletions
diff --git a/include/m_srmm_int.h b/include/m_srmm_int.h index 2d69f7d00f..2dd9488c0a 100644 --- a/include/m_srmm_int.h +++ b/include/m_srmm_int.h @@ -326,6 +326,7 @@ public: bool IsSuitableEvent(const LOGINFO &lin) const;
void RedrawLog();
void ScheduleRedrawLog();
+ void SetMessageText(const wchar_t *pwszText, bool bAppend = true);
void ShowColorChooser(int iCtrlId);
void UpdateNickList(void);
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex b7c851e16e..0d73750c4b 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex 9a38a00b1a..bcb3f6e82d 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index 08d80577bf..c9874f5428 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -77,17 +77,17 @@ void CMsgDialog::RefreshInfobar() hIcon = (HICON)CallProtoService(m_szProto, PS_GETCUSTOMSTATUSICON, bXStatus, 0);
wchar_t szText[2048];
- SETTEXTEX st;
if (szXStatusMsg && *szXStatusMsg)
mir_snwprintf(szText, L"%s (%s)", TranslateW(szXStatusName), szXStatusMsg.get());
else if (szXStatusName && *szXStatusName)
wcsncpy_s(szText, TranslateW(szXStatusName), _TRUNCATE);
else
szText[0] = 0;
- st.flags = ST_DEFAULT;
- st.codepage = 1200;
+
+ SETTEXTEX st = { ST_DEFAULT, 1200 };
SendDlgItemMessage(m_hwndInfo, IDC_INFOBAR_NAME, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)Clist_GetContactDisplayName(m_hContact));
SendDlgItemMessage(m_hwndInfo, IDC_INFOBAR_STATUS, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)szContactStatusMsg);
+
hIcon = (HICON)SendDlgItemMessage(m_hwndInfo, IDC_XSTATUSICON, STM_SETICON, (WPARAM)hIcon, 0);
if (hIcon)
DestroyIcon(hIcon);
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 22bd7c8a08..d062cf512a 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -380,14 +380,9 @@ void CMsgDialog::onClick_Quote(CCtrlButton*) if (!hDbEventLast)
return;
- SETTEXTEX st;
- st.flags = ST_SELECTION;
- st.codepage = 1200;
-
wchar_t *buffer = m_pLog->GetSelection();
if (buffer != nullptr) {
- CMStringW quotedBuffer(Srmm_Quote(buffer));
- m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&st, (LPARAM)quotedBuffer.c_str());
+ SetMessageText(Srmm_Quote(buffer));
mir_free(buffer);
}
else {
@@ -396,12 +391,8 @@ void CMsgDialog::onClick_Quote(CCtrlButton*) return;
if (DbEventIsMessageOrCustom(dbei)) {
- buffer = DbEvent_GetTextW(&dbei, CP_ACP);
- if (buffer != nullptr) {
- CMStringW quotedBuffer(Srmm_Quote(buffer));
- m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&st, (LPARAM)quotedBuffer.c_str());
- mir_free(buffer);
- }
+ ptrW wszText(DbEvent_GetTextW(&dbei, CP_ACP));
+ SetMessageText(Srmm_Quote(wszText));
}
}
SetFocus(m_message.GetHwnd());
diff --git a/plugins/Scriver/src/msgtimedout.cpp b/plugins/Scriver/src/msgtimedout.cpp index 5595b5aaf6..2ea8412755 100644 --- a/plugins/Scriver/src/msgtimedout.cpp +++ b/plugins/Scriver/src/msgtimedout.cpp @@ -58,9 +58,7 @@ public: m_errorText.SetText(m_wszDescr);
SetWindowText(m_hwnd, m_wszName);
- SETTEXTEX st = { 0 };
- st.flags = ST_DEFAULT;
- st.codepage = 1200;
+ SETTEXTEX st = { ST_DEFAULT, 1200 };
m_msgText.SendMsg(EM_SETTEXTEX, (WPARAM)&st, (LPARAM)m_wszText.get());
RECT rc, rcParent;
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index a5f22c0b82..8f6d86edb5 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -597,8 +597,7 @@ bool CMsgDialog::OnInitDialog() // restore saved msg if any...
ptrW wszSavedMsg(g_plugin.getWStringA(m_hContact, "SavedMsg"));
if (wszSavedMsg != 0) {
- SETTEXTEX stx = { ST_DEFAULT, 1200 };
- m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, wszSavedMsg);
+ SetMessageText(wszSavedMsg, false);
UpdateSaveAndSendButton();
if (m_pContainer->m_hwndActive == m_hwnd)
UpdateReadChars();
@@ -938,8 +937,7 @@ void CMsgDialog::onClick_Quote(CCtrlButton*) }
if (!szQuoted.IsEmpty()) {
- SETTEXTEX stx = { ST_SELECTION, 1200 };
- m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted.c_str());
+ SetMessageText(szQuoted);
SetFocus(m_message.GetHwnd());
}
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index d4bd43e373..3a1b7cd89d 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -903,3 +903,4 @@ Clist_GroupSaveExpanded @1003 NONAME ?Srmm_IsCustomLogUsed@@YG_NXZ @1020 NONAME
?IconFlashTime@Clist@@3V?$CMOption@I@@A @1021 NONAME
?Srmm_Quote@@YG?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@PB_WH@Z @1022 NONAME
+?SetMessageText@CSrmmBaseDialog@@QAEXPB_W_N@Z @1023 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 9a2dfd3ef0..eb3ea2ac3b 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -903,3 +903,4 @@ Clist_GroupSaveExpanded @1003 NONAME ?Srmm_IsCustomLogUsed@@YA_NXZ @1020 NONAME
?IconFlashTime@Clist@@3V?$CMOption@I@@A @1021 NONAME
?Srmm_Quote@@YA?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@PEB_WH@Z @1022 NONAME
+?SetMessageText@CSrmmBaseDialog@@QEAAXPEB_W_N@Z @1023 NONAME
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 2fef70866e..92107865db 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -648,6 +648,17 @@ void CSrmmBaseDialog::UpdateOptions() RedrawLog();
}
+void CSrmmBaseDialog::SetMessageText(const wchar_t *pwszText, bool bAppend)
+{
+ if (!pwszText)
+ pwszText = L"";
+
+ SETTEXTEX stx;
+ stx.codepage = 1200;
+ stx.flags = (bAppend) ? ST_SELECTION : ST_DEFAULT;
+ m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)pwszText);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
void CSrmmBaseDialog::RedrawLog()
|