From 0805744c4b2f73149d27f5fbadb767d3d5bd50b1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 3 Dec 2023 15:47:12 +0300 Subject: SRMM: quote panel --- src/core/stdmsg/res/resource.rc | 17 +++++++++------- src/core/stdmsg/src/msgdialog.cpp | 42 +++++++++++++++++++++++++++++---------- src/core/stdmsg/src/msgs.h | 2 +- src/core/stdmsg/src/resource.h | 16 ++++++++++++++- src/mir_app/src/mir_app.def | 2 ++ src/mir_app/src/mir_app64.def | 2 ++ src/mir_app/src/srmm_base.cpp | 32 +++++++++++++++++++++++++++++ 7 files changed, 93 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc index 5a567442a8..48b936936b 100644 --- a/src/core/stdmsg/res/resource.rc +++ b/src/core/stdmsg/res/resource.rc @@ -1,7 +1,6 @@ // Microsoft Visual C++ generated resource script. // #include "..\src\resource.h" -#include "..\..\include\chat_resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// @@ -9,6 +8,7 @@ // Generated from the TEXTINCLUDE 2 resource. // #include +#include "..\..\include\chat_resource.h" #include "..\..\include\statusmodes.h" ///////////////////////////////////////////////////////////////////////////// @@ -82,12 +82,14 @@ 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 - CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,108,251,2 + DEFPUSHBUTTON "&Send",IDOK,212,110,39,29 + CONTROL "",IDC_SRMM_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x844,1,5,175,91,WS_EX_STATICEDGE + CONTROL "",IDC_SPLITTERX,"Static",SS_ENHMETAFILE,180,4,2,89 + CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,108,251,1 LISTBOX IDC_SRMM_NICKLIST,182,2,69,94,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE CONTROL "",IDC_AVATAR,"Button",BS_OWNERDRAW | NOT WS_VISIBLE,1,127,6,13 + CONTROL "",IDC_SRMM_QUOTE,"RichEdit50W",ES_AUTOHSCROLL | WS_DISABLED | WS_BORDER | WS_TABSTOP,0,95,235,16 + CONTROL "",IDC_SRMM_CLOSEQUOTE,"MButtonClass", WS_TABSTOP,237,97,16,16 END IDD_OPT_MSGHIST DIALOGEX 0, 0, 311, 171 @@ -336,13 +338,14 @@ END 1 TEXTINCLUDE BEGIN - "..\\sxr\\resource.h\0" + "..\\src\\resource.h\0" END 2 TEXTINCLUDE BEGIN "#include \r\n" - "#include ""statusmodes.h""\r\n" + "#include ""..\\..\\include\\chat_resource.h""\r\n" + "#include ""..\\..\\include\\statusmodes.h""\r\n" "\0" END diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index ad51592f24..c9caf7fe33 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -489,16 +489,34 @@ 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; + if (m_hQuoteEvent) + urc->rcItem.top += 22; 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++; - } + m_rcMessage = urc->rcItem; + return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; + + case IDC_SRMM_QUOTE: + urc->rcItem = m_rcMessage; + urc->rcItem.top -= 22; + urc->rcItem.bottom = m_rcMessage.top; + urc->rcItem.right -= 22; + return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; + + case IDC_SRMM_CLOSEQUOTE: + urc->rcItem = m_rcMessage; + urc->rcItem.top -= 22; + urc->rcItem.bottom = m_rcMessage.top; + urc->rcItem.left = m_rcMessage.right - 22; + return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; + + case IDC_FRAME: + urc->rcItem = m_rcMessage; + urc->rcItem.left--; urc->rcItem.top--; + urc->rcItem.right++; urc->rcItem.bottom++; return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; case IDC_AVATAR: @@ -871,12 +889,14 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) } break; - case WM_SETFOCUS: { - const char* enc = (const char*)CallProtoService(m_szProto, PS_GETCAPS, PFLAG_GETCURRENTENCRYPTION, m_hContact); - if (enc == (const char *)CALLSERVICE_NOTFOUND) - enc = nullptr; - ShowWindow(GetDlgItem(m_hwnd, IDC_FRAME), enc ? SW_SHOW : SW_HIDE); - } + case WM_SETFOCUS: + { + const char *enc = (const char *)CallProtoService(m_szProto, PS_GETCAPS, PFLAG_GETCURRENTENCRYPTION, m_hContact); + if (enc == (const char *)CALLSERVICE_NOTFOUND) + enc = nullptr; + ShowWindow(GetDlgItem(m_hwnd, IDC_FRAME), enc ? SW_SHOW : SW_HIDE); + } + break; case WM_KEYDOWN: bool isShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0; diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 48c68fe5a9..5e40d57e0a 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -60,7 +60,7 @@ class CMsgDialog : public CSrmmBaseDialog int m_iSplitterX, m_iSplitterY; SIZE m_minEditBoxSize; RECT m_minEditInit; - RECT m_rcLog; + RECT m_rcLog, m_rcMessage; // tab autocomplete int m_iTabStart = 0; diff --git a/src/core/stdmsg/src/resource.h b/src/core/stdmsg/src/resource.h index e0436a8abd..aaefd5ce20 100644 --- a/src/core/stdmsg/src/resource.h +++ b/src/core/stdmsg/src/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by resource.rc +// Used by W:\miranda-ng\src\core\stdmsg\res\resource.rc // #define IDD_MSGSENDERROR 102 #define IDD_OPTIONS2 103 @@ -151,6 +151,20 @@ #define IDC_USETABS 1620 #define IDC_CLOSETABS 1621 #define IDC_TABSBOTTOM 1623 +#define IDC_SRMM_COLOR 3001 +#define IDC_SRMM_BKGCOLOR 3002 +#define IDC_SRMM_BOLD 3003 +#define IDC_SRMM_ITALICS 3004 +#define IDC_SRMM_UNDERLINE 3005 +#define IDC_SRMM_FILTER 3006 +#define IDC_SRMM_CHANMGR 3007 +#define IDC_SRMM_SHOWNICKLIST 3008 +#define IDC_SRMM_HISTORY 3009 +#define IDC_SRMM_NICKLIST 3010 +#define IDC_SRMM_LOG 3011 +#define IDC_SRMM_MESSAGE 3012 +#define IDC_SRMM_QUOTE 3013 +#define IDC_SRMM_CLOSEQUOTE 3014 #define IDM_CUT 40000 #define IDM_COPY 40001 #define IDM_PASTE 40002 diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 33ebc19958..ba74665e56 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -912,3 +912,5 @@ Clist_GroupSaveExpanded @1003 NONAME ?IsReadonly@Contact@@YG_NI@Z @1030 NONAME ?Readonly@Contact@@YGXI_N@Z @1031 NONAME ?addButton@CMPluginBase@@QAEPAXPBUBBButton@@@Z @1032 NONAME +?SetQuoteEvent@CSrmmBaseDialog@@QAEXI@Z @1033 NONAME +?onClick_CloseQuote@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @1034 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index fc9a419bce..257fa93dfd 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -912,3 +912,5 @@ Clist_GroupSaveExpanded @1003 NONAME ?IsReadonly@Contact@@YA_NI@Z @1030 NONAME ?Readonly@Contact@@YAXI_N@Z @1031 NONAME ?addButton@CMPluginBase@@QEAAPEAXPEBUBBButton@@@Z @1032 NONAME +?SetQuoteEvent@CSrmmBaseDialog@@QEAAXI@Z @1033 NONAME +?onClick_CloseQuote@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @1034 NONAME diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 025ae2466c..a744a3e9e3 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -49,6 +49,9 @@ CSrmmBaseDialog::CSrmmBaseDialog(CMPluginBase &pPlugin, int idDialog, SESSION_IN m_btnItalic(this, IDC_SRMM_ITALICS), m_btnUnderline(this, IDC_SRMM_UNDERLINE), + m_Quote(this, IDC_SRMM_QUOTE), + m_btnCloseQuote(this, IDC_SRMM_CLOSEQUOTE, SKINICON_OTHER_DELETE, LPGEN("Remove quoting")), + m_si(si), m_hContact(0), m_clrInputBG(GetSysColor(COLOR_WINDOW)) @@ -60,6 +63,8 @@ CSrmmBaseDialog::CSrmmBaseDialog(CMPluginBase &pPlugin, int idDialog, SESSION_IN m_btnHistory.OnClick = Callback(this, &CSrmmBaseDialog::onClick_History); m_btnChannelMgr.OnClick = Callback(this, &CSrmmBaseDialog::onClick_ChanMgr); + m_btnCloseQuote.OnClick = Callback(this, &CSrmmBaseDialog::onClick_CloseQuote); + m_nickList.OnDblClick = Callback(this, &CSrmmBaseDialog::onDblClick_List); timerRedraw.OnEvent = Callback(this, &CSrmmBaseDialog::OnRedrawTimer); @@ -519,6 +524,9 @@ bool CSrmmBaseDialog::OnInitDialog() WindowList_Add(g_hWindowList, m_hwnd, m_hContact); SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this); + m_btnCloseQuote.Hide(); + m_Quote.Hide(); + m_bReadOnly = Contact::IsReadonly(m_hContact); if (m_bReadOnly) m_message.Hide(); @@ -874,6 +882,14 @@ void CSrmmBaseDialog::onClick_ChanMgr(CCtrlButton *pButton) Chat_DoEventHook(m_si, GC_USER_CHANMGR, nullptr, nullptr, 0); } +void CSrmmBaseDialog::onClick_CloseQuote(CCtrlButton*) +{ + m_Quote.Hide(); + m_btnCloseQuote.Hide(); + m_hQuoteEvent = 0; + Resize(); +} + void CSrmmBaseDialog::onDblClick_List(CCtrlListBox *pList) { TVHITTESTINFO hti; @@ -1068,3 +1084,19 @@ void CSrmmBaseDialog::RefreshButtonStatus() m_btnUnderline.Push(false); } } + +void CSrmmBaseDialog::SetQuoteEvent(MEVENT hEvent) +{ + DB::EventInfo dbei(hEvent); + if (dbei) { + CMStringW wszText(TranslateT("In reply to")); + wszText += L": "; + wszText += ptrW(DbEvent_GetTextW(&dbei, CP_UTF8)).get(); + m_Quote.SetText(wszText); + + m_hQuoteEvent = hEvent; + m_Quote.Show(); + m_btnCloseQuote.Show(); + Resize(); + } +} -- cgit v1.2.3