summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-05-08 18:16:59 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-05-08 18:16:59 +0300
commitaba622e13a5e4b5ce837489c1c3aad79c33a044e (patch)
tree4609c7cb80006868532e0f31d88e8fc09b85ec4a /src/core
parent5ad1609f423952a4e3c856fda0a41ab37085db17 (diff)
StdMsg: frame drawing optimization
Diffstat (limited to 'src/core')
-rw-r--r--src/core/stdmsg/res/resource.rc1
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp55
-rw-r--r--src/core/stdmsg/src/msgs.h2
-rw-r--r--src/core/stdmsg/src/resource.h1
4 files changed, 16 insertions, 43 deletions
diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc
index d6cb78f4b7..9aa1174e55 100644
--- a/src/core/stdmsg/res/resource.rc
+++ b/src/core/stdmsg/res/resource.rc
@@ -81,6 +81,7 @@ EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
CONTROL "",IDC_SRMM_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x1144,1,111,208,29,WS_EX_ACCEPTFILES | WS_EX_STATICEDGE
+ LTEXT "", IDC_FRAME, 1, 111, 208, 29, NOT WS_VISIBLE | WS_CLIPSIBLINGS
DEFPUSHBUTTON "&Send",IDOK,212,111,39,29
CONTROL "",IDC_SRMM_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x844,1,16,250,91,WS_EX_STATICEDGE
CONTROL "",IDC_SPLITTERX,"Static",SS_ENHMETAFILE,172,23,10,73
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index 62da31e2d4..22f16ec7c4 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -85,6 +85,8 @@ void CMsgDialog::Init()
timerFlash.OnEvent = Callback(this, &CMsgDialog::OnFlash);
timerType.OnEvent = Callback(this, &CMsgDialog::OnType);
+
+ m_hFrameBrush = CreateSolidBrush(0x00ff00);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -248,6 +250,7 @@ void CMsgDialog::OnDestroy()
}
Window_FreeIcon_IcoLib(m_hwnd);
+ DeleteBrush(m_hFrameBrush);
CSuper::OnDestroy();
@@ -479,11 +482,16 @@ LBL_CalcBottom:
return RD_ANCHORX_WIDTH | RD_ANCHORY_CUSTOM;
case IDC_SRMM_MESSAGE:
+ case IDC_FRAME:
urc->rcItem.right = bSend ? urc->dlgNewSize.cx - 64 : urc->dlgNewSize.cx;
urc->rcItem.top = underTB;
urc->rcItem.bottom = urc->dlgNewSize.cy - 1;
if (g_plugin.bShowAvatar && m_avatarPic)
urc->rcItem.left = m_avatarWidth + 4;
+ if (urc->wId == IDC_FRAME) {
+ urc->rcItem.left--; urc->rcItem.top--;
+ urc->rcItem.right++; urc->rcItem.bottom++;
+ }
return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
case IDC_AVATAR:
@@ -698,6 +706,10 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (LOWORD(wParam) == WA_ACTIVE)
OnActivate();
break;
+
+ case WM_CTLCOLORSTATIC:
+ if (lParam == (LPARAM)GetDlgItem(m_hwnd, IDC_FRAME))
+ return (INT_PTR)m_hFrameBrush;
}
return CSuper::DlgProc(uMsg, wParam, lParam);
@@ -726,45 +738,6 @@ static const CHARRANGE rangeAll = { 0, -1 };
LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_NCPAINT:
- if (!m_sEncryption.IsEmpty()) {
- RECT rect;
- GetWindowRect(m_message.GetHwnd(), &rect);
- HRGN region = NULL;
- if (wParam == NULLREGION) {
- region = CreateRectRgn(rect.left, rect.top, rect.right, rect.bottom);
- }
- else {
- HRGN copy = CreateRectRgn(0, 0, 0, 0);
- if (CombineRgn(copy, (HRGN)wParam, NULL, RGN_COPY))
- region = copy;
- else
- DeleteObject(copy);
- }
-
- if (region) {
- HRGN region2 = CreateRectRgn(rect.left + 1, rect.top + 1, rect.right - 1, rect.bottom - 1);
- CombineRgn(region, region, region2, RGN_DIFF);
- DeleteObject(region2);
- }
-
- if (HDC hdc = GetDCEx(m_message.GetHwnd(), region, DCX_WINDOW | DCX_CACHE | DCX_INTERSECTRGN | DCX_LOCKWINDOWUPDATE)) {
- HPEN pen = CreatePen(PS_INSIDEFRAME, 1, RGB(0, 220, 0));
- HGDIOBJ old = SelectObject(hdc, pen);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- Rectangle(hdc, 0, 0, width, height);
- SelectObject(hdc, old);
- ReleaseDC(m_message.GetHwnd(), hdc);
- DeleteObject(pen);
- }
- else if (region)
- DeleteObject(region);
-
- return 0;
- }
- break;
-
case EM_REPLACESEL:
PostMessage(m_message.GetHwnd(), EM_ACTIVATE, 0, 0);
break;
@@ -898,9 +871,7 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
const char* enc = (const char*)CallProtoService(m_szProto, PS_GETCAPS, PFLAG_GETCURRENTENCRYPTION, m_hContact);
if (enc == (const char *)CALLSERVICE_NOTFOUND)
enc = nullptr;
- if (!m_sEncryption.IsEmpty() ^ (bool)enc)
- RedrawWindow(m_message.GetHwnd(), NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
- m_sEncryption = enc;
+ ShowWindow(GetDlgItem(m_hwnd, IDC_FRAME), enc ? SW_SHOW : SW_HIDE);
}
case WM_KEYDOWN:
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h
index ec67524d0c..edad576c2e 100644
--- a/src/core/stdmsg/src/msgs.h
+++ b/src/core/stdmsg/src/msgs.h
@@ -81,7 +81,7 @@ class CMsgDialog : public CSrmmBaseDialog
uint16_t m_wMinute = 0;
bool m_bIsMeta = false, m_bWindowCascaded = false, m_bNoActivate = false;
int m_iBBarHeight = 28;
- CMStringA m_sEncryption;
+ HBRUSH m_hFrameBrush;
public:
CMsgDialog(CTabbedWindow *pOwner, MCONTACT hContact);
diff --git a/src/core/stdmsg/src/resource.h b/src/core/stdmsg/src/resource.h
index ba7a9f0c3a..e96fef18b4 100644
--- a/src/core/stdmsg/src/resource.h
+++ b/src/core/stdmsg/src/resource.h
@@ -146,6 +146,7 @@
#define IDC_AVATARHEIGHT 1613
#define IDC_SHOWSECS 1614
#define IDC_POPLIST 1616
+#define IDC_FRAME 1617
#define IDC_USETABS 1620
#define IDC_CLOSETABS 1621
#define IDC_TABSBOTTOM 1623