From 7a948f1ef804ecd9971b0869e0591c22944fa6da Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 2 Oct 2019 20:42:44 +0300 Subject: merge with SrmmLogContainer --- plugins/Scriver/res/resource.rc | 123 ++++++++---- plugins/Scriver/src/chat_log.cpp | 123 ------------ plugins/Scriver/src/globals.cpp | 1 - plugins/Scriver/src/globals.h | 2 - plugins/Scriver/src/input.cpp | 4 +- plugins/Scriver/src/msgdialog.cpp | 149 +++------------ plugins/Scriver/src/msglog.cpp | 381 ++++++++++++++++++++++++++----------- plugins/Scriver/src/msgoptions.cpp | 29 ++- plugins/Scriver/src/msgs.cpp | 1 - plugins/Scriver/src/msgs.h | 49 +++-- plugins/Scriver/src/msgutils.cpp | 44 +---- plugins/Scriver/src/resource.h | 1 - plugins/Scriver/src/srmm.cpp | 13 +- plugins/Scriver/src/stdafx.h | 6 +- plugins/Scriver/src/tabs.cpp | 2 +- 15 files changed, 452 insertions(+), 476 deletions(-) delete mode 100644 plugins/Scriver/src/chat_log.cpp (limited to 'plugins/Scriver') diff --git a/plugins/Scriver/res/resource.rc b/plugins/Scriver/res/resource.rc index 89db29772e..0b48c827f2 100644 --- a/plugins/Scriver/res/resource.rc +++ b/plugins/Scriver/res/resource.rc @@ -1,7 +1,8 @@ // Microsoft Visual C++ generated resource script. // +#pragma code_page(65001) + #include "..\src\resource.h" -#include "..\..\include\chat_resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// @@ -18,7 +19,6 @@ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1250) ///////////////////////////////////////////////////////////////////////////// // @@ -58,7 +58,8 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN GROUPBOX "Tabs",IDC_STATIC,0,0,304,118 CONTROL "Enable tabs",IDC_USETABS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,12,260,10 - CONTROL "Only show tab bar when it's needed",IDC_HIDEONETAB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,23,252,10 + CONTROL "Only show tab bar when it's needed",IDC_HIDEONETAB, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,23,252,10 CONTROL "Tabs at the bottom",IDC_TABSATBOTTOM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,34,252,10 CONTROL "Limit names on tabs to",IDC_LIMITNAMES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,45,126,10 EDITTEXT IDC_LIMITNAMESLEN,212,44,30,12,ES_RIGHT | ES_NUMBER @@ -106,41 +107,40 @@ BEGIN LTEXT "You can use embedded variables here: %name% for contact's name, %status% for its status, %statusmsg% for its status message and %account% for its account's name",IDC_STATIC,17,38,279,25 END -IDD_OPT_MSGLOG DIALOGEX 2, 0, 304, 232 +IDD_OPT_MSGLOG DIALOGEX 2, 0, 304, 221 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX "Message window event log",IDC_STMSGLOGGROUP,0,0,304,181 - CONTROL "Enable IEView",IDC_USEIEVIEW,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,8,12,140,10 - CONTROL "Show icons",IDC_SHOWLOGICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,25,140,10 - CONTROL "Show time",IDC_SHOWTIMES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,36,140,10 - CONTROL "Show seconds",IDC_SHOWSECONDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,47,132,10 - CONTROL "Show date",IDC_SHOWDATES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,58,132,10 - CONTROL "Long date format",IDC_USELONGDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,69,123,10 - CONTROL "Relative date",IDC_USERELATIVEDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,80,123,10 - CONTROL "Hide names",IDC_HIDENAMES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,25,140,10 - CONTROL "Enable message grouping",IDC_GROUPMESSAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,36,140,10 + GROUPBOX "Message window event log",IDC_STMSGLOGGROUP,0,0,304,166 + CONTROL "Show icons",IDC_SHOWLOGICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,12,140,10 + CONTROL "Show time",IDC_SHOWTIMES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,23,140,10 + CONTROL "Show seconds",IDC_SHOWSECONDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,34,132,10 + CONTROL "Show date",IDC_SHOWDATES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,45,132,10 + CONTROL "Long date format",IDC_USELONGDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,27,56,123,10 + CONTROL "Relative date",IDC_USERELATIVEDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,27,67,123,10 + CONTROL "Hide names",IDC_HIDENAMES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,156,12,140,10 + CONTROL "Enable message grouping",IDC_GROUPMESSAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,156,23,140,10 CONTROL "Mark follow-up messages with timestamp",IDC_MARKFOLLOWUPS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,47,132,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,164,34,132,10 CONTROL "Start message text on a new line",IDC_MESSAGEONNEWLINE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,58,140,10 - CONTROL "Show lines between messages",IDC_DRAWLINES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,69,120,10 - CONTROL "Indent text",IDC_INDENTTEXT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,80,102,10 - EDITTEXT IDC_INDENTSIZE,262,79,33,12,ES_RIGHT | ES_NUMBER | WS_DISABLED + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,156,45,140,10 + CONTROL "Show lines between messages",IDC_DRAWLINES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,156,56,120,10 + CONTROL "Indent text",IDC_INDENTTEXT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,156,67,102,10 + EDITTEXT IDC_INDENTSIZE,262,66,33,12,ES_RIGHT | ES_NUMBER | WS_DISABLED CONTROL "Spin1",IDC_INDENTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK | WS_DISABLED,290,79,10,12 - CONTROL "Customize fonts and colors",IDC_FONTSCOLORS,"Hyperlink",0x0,8,91,200,8 - CONTROL "",IDC_SRMM_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x844,8,105,288,68,WS_EX_STATICEDGE - GROUPBOX "Preload",IDC_STATIC,0,181,304,50 - CONTROL "Unread events only",IDC_LOADUNREAD,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,192,138,10 - CONTROL "Last",IDC_LOADCOUNT,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,204,138,10 - CONTROL "Events in the last",IDC_LOADTIME,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,216,138,10 - EDITTEXT IDC_LOADCOUNTN,148,202,33,12,ES_RIGHT | ES_NUMBER | WS_DISABLED - CONTROL "Spin1",IDC_LOADCOUNTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK | WS_DISABLED,170,201,10,14 - LTEXT "events",IDC_LOADCOUNTTEXT2,185,202,90,8,WS_DISABLED - EDITTEXT IDC_LOADTIMEN,148,215,33,12,ES_RIGHT | ES_NUMBER | WS_DISABLED - CONTROL "Spin1",IDC_LOADTIMESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK | WS_DISABLED,170,214,10,14 - LTEXT "minutes",IDC_STMINSOLD,185,216,90,8,WS_DISABLED + CONTROL "Customize fonts and colors",IDC_FONTSCOLORS,"Hyperlink",0x0,8,78,200,8 + CONTROL "",IDC_SRMM_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x844,8,92,288,68,WS_EX_STATICEDGE + GROUPBOX "Preload",IDC_STATIC,0,166,304,50 + CONTROL "Unread events only",IDC_LOADUNREAD,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,177,138,10 + CONTROL "Last",IDC_LOADCOUNT,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,189,138,10 + CONTROL "Events in the last",IDC_LOADTIME,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,201,138,10 + EDITTEXT IDC_LOADCOUNTN,150,187,33,12,ES_RIGHT | ES_NUMBER | WS_DISABLED + CONTROL "Spin1",IDC_LOADCOUNTSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK | WS_DISABLED,173,188,10,14 + LTEXT "events",IDC_LOADCOUNTTEXT2,185,187,90,8,WS_DISABLED + EDITTEXT IDC_LOADTIMEN,150,200,33,12,ES_RIGHT | ES_NUMBER | WS_DISABLED + CONTROL "Spin1",IDC_LOADTIMESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK | WS_DISABLED,175,200,11,14 + LTEXT "minutes",IDC_STMINSOLD,185,201,90,8,WS_DISABLED END IDD_OPT_MSGTYPE DIALOGEX 0, 0, 283, 252 @@ -344,11 +344,11 @@ BEGIN VERTGUIDE, 10 VERTGUIDE, 19 VERTGUIDE, 28 - VERTGUIDE, 148 + VERTGUIDE, 150 VERTGUIDE, 156 VERTGUIDE, 169 VERTGUIDE, 300 - BOTTOMMARGIN, 229 + BOTTOMMARGIN, 218 HORZGUIDE, 199 END @@ -434,64 +434,116 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_ADDCONTACT ICON "addcontact.ico" + IDI_USERDETAILS ICON "details.ico" + IDI_HISTORY ICON "history.ico" + IDI_SEND ICON "send.ico" + IDI_SMILEY ICON "smiley.ico" + IDI_TYPING ICON "typing.ico" + IDI_TYPINGOFF ICON "typingoff.ico" + IDI_TIMESTAMP ICON "clock.ico" + IDI_QUOTE ICON "quote.ico" + IDI_INCOMING ICON "message.ico" + IDI_OUTGOING ICON "messageout.ico" + IDI_NOTICE ICON "highlight.ico" + IDI_CLOSEX ICON "closex.ico" + IDI_BUNDERLINE ICON "chat/underline.ico" + IDI_BBOLD ICON "chat/bold.ico" + IDI_BITALICS ICON "chat/italic.ico" + IDI_JOIN ICON "chat/join.ico" + IDI_TOPIC ICON "chat/topic.ico" + IDI_ADDSTATUS ICON "chat/addmode.ico" + IDI_INFO ICON "chat/info.ico" + IDI_KICK ICON "chat/kick.ico" + IDI_NICK ICON "chat/nick.ico" + IDI_CHAT_NOTICE ICON "chat/notice.ico" + IDI_PART ICON "chat/part.ico" + IDI_QUIT ICON "chat/quit.ico" + IDI_REMSTATUS ICON "chat/removestatus.ico" + IDI_ACTION ICON "chat/action.ico" + IDI_TOPICBUT ICON "chat/topicbut.ico" + IDI_BKGCOLOR ICON "chat/bkgcolor.ico" + IDI_CHANMGR ICON "chat/window.ico" + IDI_COLOR ICON "chat/color.ico" + IDI_FILTER ICON "chat/filter.ico" + IDI_NICKLIST ICON "chat/nicklist.ico" + IDI_STATUS3 ICON "chat/4.ico" + IDI_STATUS2 ICON "chat/3.ico" + IDI_STATUS4 ICON "chat/5.ico" + IDI_STATUS1 ICON "chat/2.ico" + IDI_STATUS0 ICON "chat/1.ico" + IDI_STATUS5 ICON "chat/6.ico" + IDI_OVERLAY ICON "chat/overlay.ico" + IDI_NICKLIST2 ICON "chat/nicklist2.ico" + IDI_FILTER2 ICON "chat/filter2.ico" + IDI_GOOGLE ICON "google.ico" + IDI_BING ICON "bing.ico" + IDI_YANDEX ICON "yandex.ico" + IDI_WIKIPEDIA ICON "wikipedia.ico" + IDI_GOOGLE_MAPS ICON "gmaps.ico" + IDI_GOOGLE_TRANSLATE ICON "gtranslate.ico" + IDI_YAHOO ICON "yahoo.ico" + IDI_FOODNETWORK ICON "foodnetwork.ico" + ///////////////////////////////////////////////////////////////////////////// // // Cursor // IDC_HYPERLINKHAND CURSOR "hyperlin.cur" + IDC_DRAGCURSOR CURSOR "dragcopy.cur" + ///////////////////////////////////////////////////////////////////////////// // // Menu @@ -532,6 +584,11 @@ BEGIN 0 END +IDD_OPT_MSGLOG AFX_DIALOG_LAYOUT +BEGIN + 0 +END + #endif // Neutral resources ///////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Scriver/src/chat_log.cpp b/plugins/Scriver/src/chat_log.cpp deleted file mode 100644 index acc786eb4b..0000000000 --- a/plugins/Scriver/src/chat_log.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* -Chat module plugin for Miranda IM - -Copyright (C) 2003 Jörgen Persson -Copyright 2003-2009 Miranda ICQ/IM project, - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "stdafx.h" - -#ifndef EM_GETSCROLLPOS -#define EM_GETSCROLLPOS (WM_USER+221) -#endif - -void CMsgDialog::StreamInEvents(LOGINFO *lin, bool bRedraw) -{ - if (m_hwnd == nullptr || lin == nullptr || m_si == nullptr) - return; - - if (!bRedraw && (m_si->iType == GCW_CHATROOM || m_si->iType == GCW_PRIVMESS) && m_bFilterEnabled && !(m_iLogFilterFlags & lin->iType)) - return; - - LOGSTREAMDATA streamData; - memset(&streamData, 0, sizeof(streamData)); - streamData.hwnd = m_log.GetHwnd(); - streamData.si = m_si; - streamData.lin = lin; - streamData.bStripFormat = FALSE; - streamData.isFirst = bRedraw ? 1 : m_log.GetRichTextLength() == 0; - - EDITSTREAM stream = { 0 }; - stream.pfnCallback = Srmm_LogStreamCallback; - stream.dwCookie = (DWORD_PTR)&streamData; - - SCROLLINFO scroll; - scroll.cbSize = sizeof(SCROLLINFO); - scroll.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; - GetScrollInfo(m_log.GetHwnd(), SB_VERT, &scroll); - - POINT point = { 0 }; - m_log.SendMsg(EM_GETSCROLLPOS, 0, (LPARAM)&point); - - // do not scroll to bottom if there is a selection - CHARRANGE oldsel, sel, newsel; - m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&oldsel); - if (oldsel.cpMax != oldsel.cpMin) - m_log.SendMsg(WM_SETREDRAW, FALSE, 0); - - // set the insertion point at the bottom - sel.cpMin = sel.cpMax = m_log.GetRichTextLength(); - m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); - m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel); - - // fix for the indent... must be a M$ bug - if (sel.cpMax == 0) - bRedraw = TRUE; - - // should the event(s) be appended to the current log - WPARAM wp = bRedraw ? SF_RTF : SFF_SELECTION | SF_RTF; - - // get the number of pixels per logical inch - bool bFlag = false; - if (bRedraw) { - m_log.SendMsg(WM_SETREDRAW, FALSE, 0); - bFlag = true; - } - - // stream in the event(s) - streamData.lin = lin; - streamData.bRedraw = bRedraw; - m_log.SendMsg(EM_STREAMIN, wp, (LPARAM)&stream); - - // do smileys - if (g_dat.smileyAddInstalled && (bRedraw || (lin->ptszText && lin->iType != GC_EVENT_JOIN && lin->iType != GC_EVENT_NICK && lin->iType != GC_EVENT_ADDSTATUS && lin->iType != GC_EVENT_REMOVESTATUS))) { - newsel.cpMax = -1; - newsel.cpMin = sel.cpMin; - if (newsel.cpMin < 0) - newsel.cpMin = 0; - - SMADD_RICHEDIT3 sm = { sizeof(sm) }; - sm.hwndRichEditControl = m_log.GetHwnd(); - sm.Protocolname = m_si->pszModule; - sm.rangeToReplace = bRedraw ? nullptr : &newsel; - sm.flags = 0; - sm.disableRedraw = TRUE; - sm.hContact = m_hContact; - CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&sm); - } - - // scroll log to bottom if the log was previously scrolled to bottom, else restore old position - if (bRedraw || (UINT)scroll.nPos >= (UINT)scroll.nMax - scroll.nPage - 5 || scroll.nMax - scroll.nMin - scroll.nPage < 50) - ScrollToBottom(); - else - m_log.SendMsg(EM_SETSCROLLPOS, 0, (LPARAM)&point); - - // do we need to restore the selection - if (oldsel.cpMax != oldsel.cpMin) { - m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&oldsel); - m_log.SendMsg(WM_SETREDRAW, TRUE, 0); - InvalidateRect(m_log.GetHwnd(), nullptr, TRUE); - } - - // need to invalidate the window - if (bFlag) { - sel.cpMin = sel.cpMax = m_log.GetRichTextLength(); - m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); - m_log.SendMsg(WM_SETREDRAW, TRUE, 0); - InvalidateRect(m_log.GetHwnd(), nullptr, TRUE); - } -} diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index cc69569287..34b64b6081 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -352,7 +352,6 @@ void ReloadGlobals() g_dat.flags.bStayMinimized = g_plugin.bStayMinimized; g_dat.flags.bSaveDrafts = g_plugin.bSaveDrafts; g_dat.flags.bDelTemp = g_plugin.bDelTemp; - g_dat.flags.bUseIeview = g_plugin.bUseIeview; g_dat.sendMode = (SendMode)g_plugin.getByte(SRMSGSET_SENDMODE, SRMSGDEFSET_SENDMODE); g_dat.openFlags = g_plugin.iPopFlags; diff --git a/plugins/Scriver/src/globals.h b/plugins/Scriver/src/globals.h index 1701681025..19b61bdcb9 100644 --- a/plugins/Scriver/src/globals.h +++ b/plugins/Scriver/src/globals.h @@ -48,7 +48,6 @@ struct WindowFlags bool bShowProgress : 1; bool bShowAvatar : 1; bool bRtl : 1; - bool bUseIeview : 1; bool bShowIcons : 1; bool bHideNames : 1; bool bShowTime : 1; @@ -107,7 +106,6 @@ struct GlobalMessageData SendMode sendMode; int tabIconListUsageSize; int smileyAddInstalled; - int ieviewInstalled; int limitTabsNum; int limitChatsTabsNum; int indentSize; diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index db9ba52e01..518bdbc224 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -134,8 +134,8 @@ bool CMsgDialog::CheckSend() if (m_iLastEnterTime + 1000 < GetTickCount()) m_iLastEnterTime = GetTickCount(); else { - m_log.SendMsg(WM_KEYDOWN, VK_BACK, 0); - m_log.SendMsg(WM_KEYUP, VK_BACK, 0); + LOG()->WndProc(WM_KEYDOWN, VK_BACK, 0); + LOG()->WndProc(WM_KEYUP, VK_BACK, 0); PostMessage(m_hwnd, WM_COMMAND, IDOK, 0); return true; } diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 82a13c15ba..75a58a7717 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -230,7 +230,6 @@ bool CMsgDialog::OnInitDialog() m_startTime = time(0); m_bUseRtl = g_plugin.getByte(m_hContact, "UseRTL", 0) != 0; - m_bUseIEView = (g_dat.ieviewInstalled) ? g_dat.flags.bUseIeview && !m_si : false; PARAFORMAT2 pf2; memset(&pf2, 0, sizeof(pf2)); @@ -246,22 +245,6 @@ bool CMsgDialog::OnInitDialog() } m_message.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2); - // Workaround to make Richedit display RTL messages correctly - memset(&pf2, 0, sizeof(pf2)); - pf2.cbSize = sizeof(pf2); - pf2.dwMask = PFM_RTLPARA | PFM_OFFSETINDENT | PFM_RIGHTINDENT; - pf2.wEffects = PFE_RTLPARA; - pf2.dxStartIndent = 30; - pf2.dxRightIndent = 30; - m_log.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2); - - pf2.dwMask = PFM_RTLPARA; - pf2.wEffects = 0; - m_log.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2); - - DWORD dwExStyle = GetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE); - SetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE, (m_bUseRtl) ? dwExStyle | WS_EX_LEFTSCROLLBAR :dwExStyle & ~WS_EX_LEFTSCROLLBAR); - RECT rc; GetWindowRect(m_message.GetHwnd(), &rc); m_minLogBoxHeight = m_minEditBoxHeight = rc.bottom - rc.top; @@ -290,14 +273,6 @@ bool CMsgDialog::OnInitDialog() SendMessage(m_hwnd, DM_CHANGEICONS, 0, 0); - m_log.SendMsg(EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_LINK | ENM_KEYEVENTS); - m_log.SendMsg(EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR); - m_log.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_log.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~(IMF_AUTOKEYBOARD | IMF_AUTOFONTSIZEADJUST)); - m_log.SendMsg(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0)); - m_log.SendMsg(EM_LIMITTEXT, sizeof(wchar_t) * 0x7FFFFFFF, 0); - m_log.SendMsg(EM_HIDESELECTION, TRUE, 0); - m_log.SendMsg(EM_AUTOURLDETECT, TRUE, 0); - m_message.SetReadOnly(false); m_message.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_message.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD); m_message.SendMsg(EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE); @@ -308,23 +283,9 @@ bool CMsgDialog::OnInitDialog() } // get around a lame bug in the Windows template resource code where richedits are limited to 0x7FFF - m_log.SendMsg(EM_LIMITTEXT, sizeof(wchar_t) * 0x7FFFFFFF, 0); ::DragAcceptFiles(m_message.GetHwnd(), TRUE); CreateInfobar(); - if (m_bUseIEView) { - IEVIEWWINDOW ieWindow = { sizeof(IEVIEWWINDOW) }; - ieWindow.iType = IEW_CREATE; - ieWindow.dwMode = IEWM_SCRIVER; - ieWindow.parent = m_hwnd; - ieWindow.cx = 200; - ieWindow.cy = 300; - CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); - m_hwndIeview = ieWindow.hwnd; - if (m_hwndIeview == nullptr) - m_bUseIEView = false; - } - if (isChat()) { UpdateOptions(); UpdateStatusBar(); @@ -478,12 +439,7 @@ void CMsgDialog::OnDestroy() m_si->pDlg = nullptr; m_pParent->RemoveChild(m_hwnd); - if (m_hwndIeview != nullptr) { - IEVIEWWINDOW ieWindow = { sizeof(ieWindow) }; - ieWindow.iType = IEW_DESTROY; - ieWindow.hwnd = m_hwndIeview; - CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); - } + NotifyEvent(MSG_WINDOW_EVT_CLOSE); mir_free(m_wszSearchQuery); @@ -591,16 +547,7 @@ void CMsgDialog::onClick_Quote(CCtrlButton*) st.flags = ST_SELECTION; st.codepage = 1200; - wchar_t *buffer = nullptr; - if (m_hwndIeview != nullptr) { - IEVIEWEVENT evt = { sizeof(evt) }; - evt.hwnd = m_hwndIeview; - evt.hContact = m_hContact; - evt.iType = IEE_GET_SELECTION; - buffer = mir_wstrdup((wchar_t*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&evt)); - } - else buffer = GetRichEditSelection(m_log.GetHwnd()); - + wchar_t *buffer = m_pLog->GetSelection(); if (buffer != nullptr) { wchar_t *quotedBuffer = GetQuotedTextW(buffer); m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&st, (LPARAM)quotedBuffer); @@ -674,7 +621,7 @@ void CMsgDialog::onClick_ShowList(CCtrlButton *pButton) m_bNicklistEnabled = !m_bNicklistEnabled; pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bNicklistEnabled ? IDI_NICKLIST : IDI_NICKLIST2)); - ScrollToBottom(); + m_pLog->ScrollToBottom(); Resize(); } @@ -754,7 +701,7 @@ void CMsgDialog::MessageDialogResize(int w, int h) logH -= toolbarHeight; HDWP hdwp = BeginDeferWindowPos(5); - hdwp = DeferWindowPos(hdwp, m_log.GetHwnd(), nullptr, 1, 0, bNick ? w - pdat->iSplitterX - 1 : w - 2, logH, SWP_NOZORDER); + hdwp = DeferWindowPos(hdwp, m_pLog->GetHwnd(), nullptr, 1, 0, bNick ? w - pdat->iSplitterX - 1 : w - 2, logH, SWP_NOZORDER); hdwp = DeferWindowPos(hdwp, m_nickList.GetHwnd(), nullptr, w - pdat->iSplitterX + 2, 0, pdat->iSplitterX - 3, logH, SWP_NOZORDER); hdwp = DeferWindowPos(hdwp, m_splitterX.GetHwnd(), nullptr, w - pdat->iSplitterX, 1, 2, logH, SWP_NOZORDER); hdwp = DeferWindowPos(hdwp, m_splitterY.GetHwnd(), nullptr, 0, h - pdat->iSplitterY, w, SPLITTER_HEIGHT, SWP_NOZORDER); @@ -821,7 +768,7 @@ void CMsgDialog::MessageDialogResize(int w, int h) HDWP hdwp = BeginDeferWindowPos(5); hdwp = DeferWindowPos(hdwp, m_hwndInfo, nullptr, 1, 0, w - 2, infobarInnerHeight - 2, SWP_NOZORDER); - hdwp = DeferWindowPos(hdwp, m_log.GetHwnd(), nullptr, 1, logY, w - 2, logH, SWP_NOZORDER); + hdwp = DeferWindowPos(hdwp, m_pLog->GetHwnd(), nullptr, 1, logY, w - 2, logH, SWP_NOZORDER); hdwp = DeferWindowPos(hdwp, m_message.GetHwnd(), nullptr, 1, h - hSplitterPos - 1, messageEditWidth, hSplitterPos, SWP_NOZORDER); hdwp = DeferWindowPos(hdwp, GetDlgItem(m_hwnd, IDC_AVATAR), nullptr, w - avatarWidth - 1, h - (avatarHeight + avatarWidth) / 2 - 1, avatarWidth, avatarWidth, SWP_NOZORDER); hdwp = DeferWindowPos(hdwp, m_splitterY.GetHwnd(), nullptr, 0, h - hSplitterPos - SPLITTER_HEIGHT - 1, toolbarWidth, SPLITTER_HEIGHT, SWP_NOZORDER); @@ -833,19 +780,6 @@ void CMsgDialog::MessageDialogResize(int w, int h) SetButtonsPos(m_hwnd, m_hContact, bToolbar); - if (m_hwndIeview != nullptr) { - IEVIEWWINDOW ieWindow = { sizeof(ieWindow) }; - ieWindow.iType = IEW_SETPOS; - ieWindow.parent = m_hwnd; - ieWindow.hwnd = m_hwndIeview; - ieWindow.x = 0; - ieWindow.y = logY; - ieWindow.cx = w; - ieWindow.cy = logH; - CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); - } - else RedrawWindow(m_log.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); - RedrawWindow(m_message.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); } @@ -923,9 +857,9 @@ INT_PTR CALLBACK CMsgDialog::FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wPara ///////////////////////////////////////////////////////////////////////////////////////// -LRESULT CMsgDialog::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CLogWindow::WndProc(UINT msg, WPARAM wParam, LPARAM lParam) { - int result = InputAreaShortcuts(m_log.GetHwnd(), msg, wParam, lParam); + int result = m_pDlg.InputAreaShortcuts(m_rtf.GetHwnd(), msg, wParam, lParam); if (result != -1) return result; @@ -938,20 +872,20 @@ LRESULT CMsgDialog::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam) return DrawMenuItem(wParam, lParam); case WM_LBUTTONUP: - if (isChat()) { + if (m_pDlg.isChat()) { CHARRANGE sel; - SendMessage(m_log.GetHwnd(), EM_EXGETSEL, 0, (LPARAM)&sel); + SendMessage(m_rtf.GetHwnd(), EM_EXGETSEL, 0, (LPARAM)&sel); if (sel.cpMin != sel.cpMax) { - SendMessage(m_log.GetHwnd(), WM_COPY, 0, 0); + SendMessage(m_rtf.GetHwnd(), WM_COPY, 0, 0); sel.cpMin = sel.cpMax; - SendMessage(m_log.GetHwnd(), EM_EXSETSEL, 0, (LPARAM)&sel); + SendMessage(m_rtf.GetHwnd(), EM_EXSETSEL, 0, (LPARAM)&sel); } - SetFocus(m_message.GetHwnd()); + SetFocus(m_pDlg.m_message.GetHwnd()); } break; } - return CSuper::WndProc_Log(msg, wParam, lParam); + return CSuper::WndProc(msg, wParam, lParam); } LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) @@ -1017,7 +951,7 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) } if (wParam == VK_NEXT || wParam == VK_PRIOR) { - m_log.SendMsg(msg, wParam, lParam); + LOG()->WndProc(msg, wParam, lParam); return TRUE; } } @@ -1029,7 +963,7 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) case WM_MOUSEWHEEL: if ((GetWindowLongPtr(m_message.GetHwnd(), GWL_STYLE) & WS_VSCROLL) == 0) - m_log.SendMsg(WM_MOUSEWHEEL, wParam, lParam); + LOG()->WndProc(WM_MOUSEWHEEL, wParam, lParam); m_iLastEnterTime = 0; break; @@ -1184,7 +1118,7 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case WM_LBUTTONDBLCLK: if (LOWORD(lParam) < 30) - ScrollToBottom(); + m_pLog->ScrollToBottom(); else SendMessage(m_hwndParent, WM_SYSCOMMAND, SC_MINIMIZE, 0); break; @@ -1237,33 +1171,12 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break; case DM_OPTIONSAPPLIED: - m_bUseIEView = (g_dat.ieviewInstalled) ? g_dat.flags.bUseIeview && !m_si : false; - if (m_bUseIEView && m_hwndIeview == nullptr) { - IEVIEWWINDOW ieWindow = { sizeof(ieWindow) }; - ieWindow.iType = IEW_CREATE; - ieWindow.dwMode = IEWM_SCRIVER; - ieWindow.parent = m_hwnd; - ieWindow.cx = 200; - ieWindow.cy = 300; - CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); - m_hwndIeview = ieWindow.hwnd; - if (m_hwndIeview == nullptr) - m_bUseIEView = false; - } - else if (!m_bUseIEView && m_hwndIeview != nullptr) { - IEVIEWWINDOW ieWindow = { sizeof(ieWindow) }; - ieWindow.iType = IEW_DESTROY; - ieWindow.hwnd = m_hwndIeview; - CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); - m_hwndIeview = nullptr; - } - GetAvatar(); SetDialogToType(); { - COLORREF colour = g_plugin.getDword(SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR); - m_log.SendMsg(EM_SETBKGNDCOLOR, 0, colour); - colour = g_plugin.getDword(SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR); + m_pLog->UpdateOptions(); + + COLORREF colour = g_plugin.getDword(SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR); m_message.SendMsg(EM_SETBKGNDCOLOR, 0, colour); InvalidateRect(m_message.GetHwnd(), nullptr, FALSE); @@ -1285,15 +1198,6 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) m_message.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_message.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD); } - PARAFORMAT2 pf2; - memset(&pf2, 0, sizeof(pf2)); - pf2.cbSize = sizeof(pf2); - pf2.dwMask = PFM_OFFSET; - pf2.dxOffset = (g_dat.flags.bIndentText) ? g_dat.indentSize * 1440 / g_dat.logPixelSX : 0; - m_log.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2); - m_log.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_log.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~(IMF_AUTOKEYBOARD | IMF_AUTOFONTSIZEADJUST)); - m_log.SetTextA(""); - SendMessage(m_hwnd, DM_REMAKELOG, 0, 0); UpdateTitle(); UpdateTabControl(); @@ -1371,16 +1275,11 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case DM_SETFOCUS: if (lParam == WM_MOUSEACTIVATE) { - HWND hLog; POINT pt; GetCursorPos(&pt); - if (m_hwndIeview != nullptr) - hLog = m_hwndIeview; - else - hLog = m_log.GetHwnd(); RECT rc; - GetWindowRect(hLog, &rc); + GetWindowRect(m_pLog->GetHwnd(), &rc); if (pt.x >= rc.left && pt.x <= rc.right && pt.y >= rc.top && pt.y <= rc.bottom) return TRUE; } @@ -1405,7 +1304,7 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case WM_SIZE: if (wParam == SIZE_MAXIMIZED) - ScrollToBottom(); + m_pLog->ScrollToBottom(); if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED) { RECT rc; @@ -1418,9 +1317,9 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case DM_REMAKELOG: m_lastEventType = -1; if (wParam == 0 || wParam == m_hContact) - StreamInEvents(m_hDbEventFirst, -1, 0); + m_pLog->LogEvents(m_hDbEventFirst, -1, 0); - InvalidateRect(m_log.GetHwnd(), nullptr, FALSE); + InvalidateRect(m_pLog->GetHwnd(), nullptr, FALSE); break; case HM_DBEVENTADDED: @@ -1449,7 +1348,7 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) } if (hDbEvent != m_hDbEventFirst && db_event_next(m_hContact, hDbEvent) == 0) - StreamInEvents(hDbEvent, 1, 1); + m_pLog->LogEvents(hDbEvent, 1, 1); else SendMessage(m_hwnd, DM_REMAKELOG, 0, 0); diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 087a78859a..d01d2a9bab 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -626,122 +626,6 @@ void StreamInTestEvents(HWND hEditWnd, GlobalMessageData *gdat) delete dat; } -void CMsgDialog::StreamInEvents(MEVENT hDbEventFirst, int count, int bAppend) -{ - // IEVIew MOD Begin - if (m_hwndIeview != nullptr) { - IEVIEWEVENT evt; - evt.dwFlags = (m_bUseRtl) ? IEEF_RTL : 0; - evt.hwnd = m_hwndIeview; - evt.hContact = m_hContact; - evt.pszProto = m_szProto; - if (!bAppend) { - evt.iType = IEE_CLEAR_LOG; - CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&evt); - } - evt.iType = IEE_LOG_DB_EVENTS; - evt.hDbEventFirst = hDbEventFirst; - evt.count = count; - CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&evt); - m_hDbEventLast = evt.hDbEventFirst != 0 ? evt.hDbEventFirst : m_hDbEventLast; - - IEVIEWWINDOW ieWindow = {}; - ieWindow.iType = IEW_SCROLLBOTTOM; - ieWindow.hwnd = m_hwndIeview; - CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); - return; - } - // IEVIew MOD End - - CHARRANGE oldSel, sel; - m_log.SendMsg(WM_SETREDRAW, FALSE, 0); - m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&oldSel); - - LogStreamData streamData = {}; - streamData.hContact = m_hContact; - streamData.hDbEvent = hDbEventFirst; - streamData.hDbEventLast = m_hDbEventLast; - streamData.dlgDat = this; - streamData.eventsToInsert = count; - streamData.isFirst = bAppend ? m_log.GetRichTextLength() == 0 : 1; - streamData.gdat = &g_dat; - - EDITSTREAM stream = {}; - stream.pfnCallback = LogStreamInEvents; - stream.dwCookie = (DWORD_PTR)& streamData; - sel.cpMin = 0; - - POINT scrollPos; - bool bottomScroll = (GetFocus() != m_log.GetHwnd()); - if (bottomScroll && (GetWindowLongPtr(m_log.GetHwnd(), GWL_STYLE) & WS_VSCROLL)) { - SCROLLINFO si = {}; - si.cbSize = sizeof(si); - si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; - GetScrollInfo(m_log.GetHwnd(), SB_VERT, &si); - bottomScroll = (si.nPos + (int)si.nPage) >= si.nMax; - } - if (!bottomScroll) - m_log.SendMsg(EM_GETSCROLLPOS, 0, (LPARAM)&scrollPos); - - FINDTEXTEXA fi; - if (bAppend) { - GETTEXTLENGTHEX gtxl = { 0 }; - gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMCHARS; - gtxl.codepage = 1200; - fi.chrg.cpMin = m_log.SendMsg(EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0); - sel.cpMin = sel.cpMax = m_log.GetRichTextLength(); - m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); - } - else { - m_log.SendMsg(WM_SETREDRAW, FALSE, 0); - m_log.SetTextA(""); - sel.cpMin = 0; - sel.cpMax = m_log.GetRichTextLength(); - m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); - fi.chrg.cpMin = 0; - m_isMixed = 0; - } - - m_log.SendMsg(EM_STREAMIN, bAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM)&stream); - if (bottomScroll) { - sel.cpMin = sel.cpMax = -1; - m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); - } - else { - m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&oldSel); - m_log.SendMsg(EM_SETSCROLLPOS, 0, (LPARAM)&scrollPos); - } - - if (g_dat.smileyAddInstalled) { - SMADD_RICHEDIT3 smre; - smre.cbSize = sizeof(SMADD_RICHEDIT3); - smre.hwndRichEditControl = m_log.GetHwnd(); - - MCONTACT hContact = db_mc_getSrmmSub(m_hContact); - smre.Protocolname = (hContact != 0) ? GetContactProto(hContact) : m_szProto; - - if (fi.chrg.cpMin > 0) { - sel.cpMin = fi.chrg.cpMin; - sel.cpMax = -1; - smre.rangeToReplace = &sel; - } - else smre.rangeToReplace = nullptr; - - smre.disableRedraw = TRUE; - smre.hContact = m_hContact; - smre.flags = 0; - CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&smre); - } - - m_log.SendMsg(WM_SETREDRAW, TRUE, 0); - if (bottomScroll) { - ScrollToBottom(); - RedrawWindow(m_log.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); - } - - m_hDbEventLast = streamData.hDbEventLast; -} - #define RTFPICTHEADERMAXSIZE 78 void LoadMsgLogIcons(void) @@ -820,3 +704,268 @@ void FreeMsgLogIcons(void) ImageList_RemoveAll(g_hImageList); ImageList_Destroy(g_hImageList); } + +///////////////////////////////////////////////////////////////////////////////////////// + +void CLogWindow::Attach() +{ + CSuper::Attach(); + + DWORD dwExStyle = GetWindowLongPtr(m_rtf.GetHwnd(), GWL_EXSTYLE); + SetWindowLongPtr(m_rtf.GetHwnd(), GWL_EXSTYLE, (m_pDlg.m_bUseRtl) ? dwExStyle | WS_EX_LEFTSCROLLBAR : dwExStyle & ~WS_EX_LEFTSCROLLBAR); + + // Workaround to make Richedit display RTL messages correctly + PARAFORMAT2 pf2; + memset(&pf2, 0, sizeof(pf2)); + pf2.cbSize = sizeof(pf2); + pf2.dwMask = PFM_RTLPARA | PFM_OFFSETINDENT | PFM_RIGHTINDENT; + pf2.wEffects = PFE_RTLPARA; + pf2.dxStartIndent = 30; + pf2.dxRightIndent = 30; + m_rtf.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2); + + pf2.dwMask = PFM_RTLPARA; + pf2.wEffects = 0; + m_rtf.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2); + + m_rtf.SendMsg(EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_LINK | ENM_KEYEVENTS); + m_rtf.SendMsg(EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR); + m_rtf.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_rtf.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~(IMF_AUTOKEYBOARD | IMF_AUTOFONTSIZEADJUST)); + m_rtf.SendMsg(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0)); + m_rtf.SendMsg(EM_LIMITTEXT, 0x7FFFFFFF, 0); + m_rtf.SendMsg(EM_HIDESELECTION, TRUE, 0); + m_rtf.SendMsg(EM_AUTOURLDETECT, TRUE, 0); +} + +void CLogWindow::LogEvents(MEVENT hDbEventFirst, int count, bool bAppend) +{ + CHARRANGE oldSel, sel; + m_rtf.SendMsg(WM_SETREDRAW, FALSE, 0); + m_rtf.SendMsg(EM_EXGETSEL, 0, (LPARAM)&oldSel); + + LogStreamData streamData = {}; + streamData.hContact = m_pDlg.m_hContact; + streamData.hDbEvent = hDbEventFirst; + streamData.hDbEventLast = m_pDlg.m_hDbEventLast; + streamData.dlgDat = &m_pDlg; + streamData.eventsToInsert = count; + streamData.isFirst = bAppend ? m_rtf.GetRichTextLength() == 0 : 1; + streamData.gdat = &g_dat; + + EDITSTREAM stream = {}; + stream.pfnCallback = LogStreamInEvents; + stream.dwCookie = (DWORD_PTR)&streamData; + sel.cpMin = 0; + + POINT scrollPos; + bool bottomScroll = (GetFocus() != m_rtf.GetHwnd()); + if (bottomScroll && (GetWindowLongPtr(m_rtf.GetHwnd(), GWL_STYLE) & WS_VSCROLL)) { + SCROLLINFO si = {}; + si.cbSize = sizeof(si); + si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; + GetScrollInfo(m_rtf.GetHwnd(), SB_VERT, &si); + bottomScroll = (si.nPos + (int)si.nPage) >= si.nMax; + } + if (!bottomScroll) + m_rtf.SendMsg(EM_GETSCROLLPOS, 0, (LPARAM)&scrollPos); + + FINDTEXTEXA fi; + if (bAppend) { + GETTEXTLENGTHEX gtxl = { 0 }; + gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMCHARS; + gtxl.codepage = 1200; + fi.chrg.cpMin = m_rtf.SendMsg(EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0); + sel.cpMin = sel.cpMax = m_rtf.GetRichTextLength(); + m_rtf.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); + } + else { + m_rtf.SendMsg(WM_SETREDRAW, FALSE, 0); + m_rtf.SetTextA(""); + sel.cpMin = 0; + sel.cpMax = m_rtf.GetRichTextLength(); + m_rtf.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); + fi.chrg.cpMin = 0; + m_pDlg.m_isMixed = 0; + } + + m_rtf.SendMsg(EM_STREAMIN, bAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM)&stream); + if (bottomScroll) { + sel.cpMin = sel.cpMax = -1; + m_rtf.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); + } + else { + m_rtf.SendMsg(EM_EXSETSEL, 0, (LPARAM)&oldSel); + m_rtf.SendMsg(EM_SETSCROLLPOS, 0, (LPARAM)&scrollPos); + } + + if (g_dat.smileyAddInstalled) { + SMADD_RICHEDIT3 smre; + smre.cbSize = sizeof(SMADD_RICHEDIT3); + smre.hwndRichEditControl = m_rtf.GetHwnd(); + + MCONTACT hContact = db_mc_getSrmmSub(m_pDlg.m_hContact); + smre.Protocolname = (hContact != 0) ? GetContactProto(hContact) : m_pDlg.m_szProto; + + if (fi.chrg.cpMin > 0) { + sel.cpMin = fi.chrg.cpMin; + sel.cpMax = -1; + smre.rangeToReplace = &sel; + } + else smre.rangeToReplace = nullptr; + + smre.disableRedraw = TRUE; + smre.hContact = m_pDlg.m_hContact; + smre.flags = 0; + CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&smre); + } + + m_rtf.SendMsg(WM_SETREDRAW, TRUE, 0); + if (bottomScroll) { + ScrollToBottom(); + RedrawWindow(m_rtf.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); + } + + m_pDlg.m_hDbEventLast = streamData.hDbEventLast; +} + +void CLogWindow::LogEvents(DBEVENTINFO*, bool) +{ +} + +void CLogWindow::LogEvents(LOGINFO *lin, bool bRedraw) +{ + auto *si = m_pDlg.m_si; + if (m_rtf.GetHwnd() == nullptr || lin == nullptr || si == nullptr) + return; + + if (!bRedraw && (si->iType == GCW_CHATROOM || si->iType == GCW_PRIVMESS) && m_pDlg.m_bFilterEnabled && !(m_pDlg.m_iLogFilterFlags & lin->iType)) + return; + + LOGSTREAMDATA streamData; + memset(&streamData, 0, sizeof(streamData)); + streamData.hwnd = m_rtf.GetHwnd(); + streamData.si = si; + streamData.lin = lin; + streamData.bStripFormat = FALSE; + streamData.isFirst = bRedraw ? 1 : m_rtf.GetRichTextLength() == 0; + + EDITSTREAM stream = {}; + stream.pfnCallback = Srmm_LogStreamCallback; + stream.dwCookie = (DWORD_PTR)&streamData; + + SCROLLINFO scroll; + scroll.cbSize = sizeof(SCROLLINFO); + scroll.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; + GetScrollInfo(m_rtf.GetHwnd(), SB_VERT, &scroll); + + POINT point = {}; + m_rtf.SendMsg(EM_GETSCROLLPOS, 0, (LPARAM)&point); + + // do not scroll to bottom if there is a selection + CHARRANGE oldsel, sel, newsel; + m_rtf.SendMsg(EM_EXGETSEL, 0, (LPARAM)&oldsel); + if (oldsel.cpMax != oldsel.cpMin) + m_rtf.SendMsg(WM_SETREDRAW, FALSE, 0); + + // set the insertion point at the bottom + sel.cpMin = sel.cpMax = m_rtf.GetRichTextLength(); + m_rtf.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); + m_rtf.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel); + + // fix for the indent... must be a M$ bug + if (sel.cpMax == 0) + bRedraw = TRUE; + + // should the event(s) be appended to the current log + WPARAM wp = bRedraw ? SF_RTF : SFF_SELECTION | SF_RTF; + + // get the number of pixels per logical inch + bool bFlag = false; + if (bRedraw) { + m_rtf.SendMsg(WM_SETREDRAW, FALSE, 0); + bFlag = true; + } + + // stream in the event(s) + streamData.lin = lin; + streamData.bRedraw = bRedraw; + m_rtf.SendMsg(EM_STREAMIN, wp, (LPARAM)&stream); + + // do smileys + if (g_dat.smileyAddInstalled && (bRedraw || (lin->ptszText && lin->iType != GC_EVENT_JOIN && lin->iType != GC_EVENT_NICK && lin->iType != GC_EVENT_ADDSTATUS && lin->iType != GC_EVENT_REMOVESTATUS))) { + newsel.cpMax = -1; + newsel.cpMin = sel.cpMin; + if (newsel.cpMin < 0) + newsel.cpMin = 0; + + SMADD_RICHEDIT3 sm = { sizeof(sm) }; + sm.hwndRichEditControl = m_rtf.GetHwnd(); + sm.Protocolname = si->pszModule; + sm.rangeToReplace = bRedraw ? nullptr : &newsel; + sm.flags = 0; + sm.disableRedraw = TRUE; + sm.hContact = m_pDlg.m_hContact; + CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&sm); + } + + // scroll log to bottom if the log was previously scrolled to bottom, else restore old position + if (bRedraw || (UINT)scroll.nPos >= (UINT)scroll.nMax - scroll.nPage - 5 || scroll.nMax - scroll.nMin - scroll.nPage < 50) + ScrollToBottom(); + else + m_rtf.SendMsg(EM_SETSCROLLPOS, 0, (LPARAM)&point); + + // do we need to restore the selection + if (oldsel.cpMax != oldsel.cpMin) { + m_rtf.SendMsg(EM_EXSETSEL, 0, (LPARAM)&oldsel); + m_rtf.SendMsg(WM_SETREDRAW, TRUE, 0); + InvalidateRect(m_rtf.GetHwnd(), nullptr, TRUE); + } + + // need to invalidate the window + if (bFlag) { + sel.cpMin = sel.cpMax = m_rtf.GetRichTextLength(); + m_rtf.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); + m_rtf.SendMsg(WM_SETREDRAW, TRUE, 0); + InvalidateRect(m_rtf.GetHwnd(), nullptr, TRUE); + } +} + +void CLogWindow::ScrollToBottom() +{ + if (GetWindowLongPtr(m_rtf.GetHwnd(), GWL_STYLE) & WS_VSCROLL) { + SCROLLINFO si = { sizeof(si) }; + si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; + if (GetScrollInfo(m_rtf.GetHwnd(), SB_VERT, &si)) { + if (m_rtf.GetHwnd() != GetFocus()) { + si.fMask = SIF_POS; + si.nPos = si.nMax - si.nPage + 1; + SetScrollInfo(m_rtf.GetHwnd(), SB_VERT, &si, TRUE); + + PostMessage(m_rtf.GetHwnd(), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0); + } + } + } +} + +void CLogWindow::UpdateOptions() +{ + if (m_pDlg.isChat()) + m_rtf.SendMsg(EM_SETBKGNDCOLOR, 0, g_Settings.crLogBackground); + else + m_rtf.SendMsg(EM_SETBKGNDCOLOR, 0, g_plugin.getDword(SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); + + PARAFORMAT2 pf2; + memset(&pf2, 0, sizeof(pf2)); + pf2.cbSize = sizeof(pf2); + pf2.dwMask = PFM_OFFSET; + pf2.dxOffset = (g_dat.flags.bIndentText) ? g_dat.indentSize * 1440 / g_dat.logPixelSX : 0; + m_rtf.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2); + m_rtf.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_rtf.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~(IMF_AUTOKEYBOARD | IMF_AUTOFONTSIZEADJUST)); + + Clear(); +} + +CSrmmLogWindow *logBuilder(CMsgDialog &pDlg) +{ + return new CLogWindow(pDlg); +} diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 09f89361da..d9f654c03e 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -519,15 +519,15 @@ public: class CLogOptionsDlg : public CBaseOptionDlg { CCtrlSpin spinCount, spinTime, spinIndent; - CCtrlCheck chkLoadUnread, chkLoadCount, chkLoadTime, chkUseIeview; + CCtrlCheck chkLoadUnread, chkLoadCount, chkLoadTime; CCtrlCheck chkShowIcons, chkShowTime, chkShowSecs, chkShowDate, chkLongDate, chkRelativeDate; CCtrlCheck chkGroupMsg, chkIndentText, chkHideNames, chkMarkFollowups, chkMsgOnNewline, chkDrawLines; - CCtrlRichEdit m_log; + CCtrlRichEdit m_rtf; CCtrlHyperlink m_fonts; void OnChange() override { - m_log.SetText(L""); + m_rtf.SetText(L""); struct GlobalMessageData gdat = {}; gdat.flags.bShowIcons = chkShowIcons.GetState(); @@ -548,15 +548,15 @@ class CLogOptionsDlg : public CBaseOptionDlg pf2.cbSize = sizeof(pf2); pf2.dwMask = PFM_OFFSET; pf2.dxOffset = (gdat.flags.bIndentText) ? gdat.indentSize * 1440 / g_dat.logPixelSX : 0; - m_log.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2); + m_rtf.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2); - StreamInTestEvents(m_log.GetHwnd(), &gdat); + StreamInTestEvents(m_rtf.GetHwnd(), &gdat); } public: CLogOptionsDlg() : CBaseOptionDlg(IDD_OPT_MSGLOG), - m_log(this, IDC_SRMM_LOG), + m_rtf(this, IDC_SRMM_LOG), m_fonts(this, IDC_FONTSCOLORS), chkShowTime(this, IDC_SHOWTIMES), chkShowSecs(this, IDC_SHOWSECONDS), @@ -569,7 +569,6 @@ public: chkShowIcons(this, IDC_SHOWLOGICONS), chkIndentText(this, IDC_INDENTTEXT), chkHideNames(this, IDC_HIDENAMES), - chkUseIeview(this, IDC_USEIEVIEW), chkMsgOnNewline(this, IDC_MESSAGEONNEWLINE), chkLoadTime(this, IDC_LOADTIME), chkLoadCount(this, IDC_LOADCOUNT), @@ -585,7 +584,6 @@ public: CreateLink(chkShowDate, g_plugin.bShowDate); CreateLink(chkLongDate, g_plugin.bLongDate); CreateLink(chkGroupMsg, g_plugin.bGroupMessages); - CreateLink(chkUseIeview, g_plugin.bUseIeview); CreateLink(chkShowIcons, g_plugin.bShowIcons); CreateLink(chkHideNames, g_plugin.bHideNames); CreateLink(chkDrawLines, g_plugin.bDrawLines); @@ -618,11 +616,8 @@ public: CheckDlgButton(m_hwnd, IDC_LOADTIME, BST_CHECKED); break; } - onChange_Time(0); - - if (!g_dat.ieviewInstalled) - EnableWindow(GetDlgItem(m_hwnd, IDC_USEIEVIEW), FALSE); + onChange_Time(0); onChange_Times(0); onChange_Dates(0); onChange_GroupMsg(0); @@ -634,12 +629,12 @@ public: pf2.dwMask = PFM_OFFSETINDENT | PFM_RIGHTINDENT; pf2.dxStartIndent = 30; pf2.dxRightIndent = 30; - m_log.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2); + m_rtf.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2); - m_log.SendMsg(EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR); - m_log.SendMsg(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0)); - m_log.SendMsg(EM_AUTOURLDETECT, TRUE, 0); - m_log.SetReadOnly(true); + m_rtf.SendMsg(EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR); + m_rtf.SendMsg(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0)); + m_rtf.SendMsg(EM_AUTOURLDETECT, TRUE, 0); + m_rtf.SetReadOnly(true); OnChange(); return true; diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index c2124f33f4..a2175f52e5 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -464,7 +464,6 @@ int RegisterToolbarIcons(WPARAM, LPARAM) static int ModuleLoad(WPARAM, LPARAM) { g_dat.smileyAddInstalled = ServiceExists(MS_SMILEYADD_SHOWSELECTION) && ServiceExists(MS_SMILEYADD_REPLACESMILEYS); - g_dat.ieviewInstalled = ServiceExists(MS_IEVIEW_WINDOW); return 0; } diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index d404942836..57a25aafd6 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -23,6 +23,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef SRMM_MSGS_H #define SRMM_MSGS_H +///////////////////////////////////////////////////////////////////////////////////////// +// CLogWindow - built-in log window + +class CLogWindow : public CRtfLogWindow +{ + typedef CRtfLogWindow CSuper; + +public: + CLogWindow(CMsgDialog &pDlg) : + CSuper(pDlg) + { + } + + void Attach() override; + void LogEvents(MEVENT hDbEventFirst, int count, bool bAppend) override; + void LogEvents(DBEVENTINFO *dbei, bool bAppend) override; + void LogEvents(struct LOGINFO *, bool) override; + void ScrollToBottom() override; + void UpdateOptions() override; + + INT_PTR WndProc(UINT msg, WPARAM wParam, LPARAM lParam) override; +}; + +///////////////////////////////////////////////////////////////////////////////////////// + #define MSGERROR_CANCEL 0 #define MSGERROR_RETRY 1 #define MSGERROR_DONE 2 @@ -60,6 +85,7 @@ class CMsgDialog : public CSrmmBaseDialog { typedef CSrmmBaseDialog CSuper; + friend class CLogWindow; friend struct ParentWindowData; friend INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); @@ -75,7 +101,6 @@ class CMsgDialog : public CSrmmBaseDialog void ShowAvatar(void); void SetDialogToType(void); void SetStatusIcon(void); - void StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend); void ToggleRtl(); void UpdateIcon(void); void UpdateReadChars(void); @@ -102,14 +127,13 @@ class CMsgDialog : public CSrmmBaseDialog time_t m_startTime, m_lastEventTime; int m_lastEventType; int m_isMixed; - bool m_bUseRtl, m_bUseIEView; + bool m_bUseRtl; HBITMAP m_hbmpAvatarPic; AVATARCACHEENTRY *m_ace; TCmdList *cmdList, *cmdListCurrent; ParentWindowData *m_pParent; - HWND m_hwndIeview; // info bar support HWND m_hwndInfo; @@ -153,10 +177,8 @@ public: void CloseTab() override; void LoadSettings() override; - void ScrollToBottom() override; void SetStatusText(const wchar_t *, HICON) override; void ShowFilterMenu() override; - void StreamInEvents(LOGINFO *lin, bool bRedraw) override; void UpdateNickList() override; void UpdateOptions() override; void UpdateStatusBar() override; @@ -172,20 +194,23 @@ public: void StopMessageSending(void); void ShowMessageSending(void); - LRESULT WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam) override; LRESULT WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) override; LRESULT WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam) override; - __forceinline bool IsActive() const - { return GetActiveWindow() == m_hwndParent && GetForegroundWindow() == m_hwndParent && m_pParent->m_hwndActive == m_hwnd; + __forceinline bool IsActive() const { + return GetActiveWindow() == m_hwndParent && GetForegroundWindow() == m_hwndParent && m_pParent->m_hwndActive == m_hwnd; + } + + __forceinline void PopupWindow(bool bIncoming = false) { + m_pParent->PopupWindow(this, bIncoming); } - __forceinline void PopupWindow(bool bIncoming = false) - { m_pParent->PopupWindow(this, bIncoming); + __forceinline void StartFlashing() const { + m_pParent->StartFlashing(); } - __forceinline void StartFlashing() const - { m_pParent->StartFlashing(); + __forceinline CLogWindow *LOG() { + return ((CLogWindow *)m_pLog); } wchar_t *m_wszInitialText; diff --git a/plugins/Scriver/src/msgutils.cpp b/plugins/Scriver/src/msgutils.cpp index 71fea672d6..47dc5e8de8 100644 --- a/plugins/Scriver/src/msgutils.cpp +++ b/plugins/Scriver/src/msgutils.cpp @@ -25,16 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void CMsgDialog::ClearLog() { - if (m_hwndIeview != nullptr) { - IEVIEWEVENT evt = { sizeof(evt) }; - evt.iType = IEE_CLEAR_LOG; - evt.dwFlags = (m_bUseRtl) ? IEEF_RTL : 0; - evt.hwnd = m_hwndIeview; - evt.hContact = m_hContact; - evt.pszProto = m_szProto; - CallService(MS_IEVIEW_EVENT, 0, (LPARAM)& evt); - } - else CSuper::ClearLog(); + CSuper::ClearLog(); m_hDbEventFirst = 0; m_lastEventType = -1; @@ -218,31 +209,6 @@ void CMsgDialog::Reattach(HWND hwndContainer) ///////////////////////////////////////////////////////////////////////////////////////// -void CMsgDialog::ScrollToBottom() -{ - if (m_hwndIeview != nullptr) { - IEVIEWWINDOW ieWindow = {}; - ieWindow.iType = IEW_SCROLLBOTTOM; - ieWindow.hwnd = m_hwndIeview; - CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); - return; - } - - if (GetWindowLongPtr(m_log.GetHwnd(), GWL_STYLE) & WS_VSCROLL) { - SCROLLINFO si = { sizeof(si) }; - si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; - if (GetScrollInfo(m_log.GetHwnd(), SB_VERT, &si)) { - if (m_log.GetHwnd() != GetFocus()) { - si.fMask = SIF_POS; - si.nPos = si.nMax - si.nPage + 1; - SetScrollInfo(m_log.GetHwnd(), SB_VERT, &si, TRUE); - - PostMessage(m_log.GetHwnd(), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0); - } - } - } -} - void CMsgDialog::SetDialogToType() { if (!isChat()) { @@ -257,8 +223,6 @@ void CMsgDialog::SetDialogToType() } m_message.Show(); - m_log.Show(m_hwndIeview == nullptr); - m_splitterY.Show(); m_btnOk.Enable(m_message.GetRichTextLength() != 0); Resize(); @@ -439,12 +403,12 @@ void CMsgDialog::ToggleRtl() if (m_bUseRtl) { pf2.wEffects = PFE_RTLPARA; SetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE) | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR); - SetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE) | WS_EX_LEFTSCROLLBAR); + SetWindowLongPtr(m_pLog->GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_pLog->GetHwnd(), GWL_EXSTYLE) | WS_EX_LEFTSCROLLBAR); } else { pf2.wEffects = 0; SetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE) & ~(WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR)); - SetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE) & ~(WS_EX_LEFTSCROLLBAR)); + SetWindowLongPtr(m_pLog->GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_pLog->GetHwnd(), GWL_EXSTYLE) & ~(WS_EX_LEFTSCROLLBAR)); } m_message.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2); SendMessage(m_hwnd, DM_REMAKELOG, 0, 0); @@ -493,7 +457,7 @@ void CMsgDialog::UpdateOptions() UpdateTitle(); FixTabIcons(); - m_log.SendMsg(EM_SETBKGNDCOLOR, 0, g_Settings.crLogBackground); + m_pLog->UpdateOptions(); // messagebox COLORREF crFore; diff --git a/plugins/Scriver/src/resource.h b/plugins/Scriver/src/resource.h index 5c449cdd48..14f62efbaa 100644 --- a/plugins/Scriver/src/resource.h +++ b/plugins/Scriver/src/resource.h @@ -91,7 +91,6 @@ #define IDC_SHOWSECONDS 1023 #define IDC_USELONGDATE 1024 #define IDC_USERELATIVEDATE 1025 -#define IDC_USEIEVIEW 1026 #define IDC_FONTSCOLORS 1027 #define IDC_LOADUNREAD 1031 #define IDC_SHOWLOGICONS 1032 diff --git a/plugins/Scriver/src/srmm.cpp b/plugins/Scriver/src/srmm.cpp index cb054873c2..b687894c75 100644 --- a/plugins/Scriver/src/srmm.cpp +++ b/plugins/Scriver/src/srmm.cpp @@ -54,7 +54,6 @@ CMPlugin::CMPlugin() : bTypingNew(SRMM_MODULE, "DefaultTyping", 1), bAutoClose(SRMM_MODULE, "AutoClose", 0), bAutoPopup(SRMM_MODULE, "AutoPopupMsg", 0), - bUseIeview(SRMM_MODULE, "UseIEView", 1), bSaveDrafts(SRMM_MODULE, "SaveDrafts", 0), bTypingUnknown(SRMM_MODULE, "UnknownTyping", 0), bHideContainer(SRMM_MODULE, "HideContainers", 0), @@ -125,6 +124,17 @@ int CMPlugin::Load() if (IsWinVer7Plus()) CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_ALL, IID_ITaskbarList3, (void**)&pTaskbarInterface); + hLogger = RegisterSrmmLog("built-in", L"Scriver internal log", &logBuilder); + + switch (getByte("UseIEView", -1)) { + case 1: + setString("Logger", "ieview"); + __fallthrough; + + case 0: + delSetting("UseIEView"); + } + return OnLoadModule(); } @@ -132,6 +142,7 @@ int CMPlugin::Load() int CMPlugin::Unload() { + UnregisterSrmmLog(hLogger); if (pTaskbarInterface) pTaskbarInterface->Release(); return OnUnloadModule(); diff --git a/plugins/Scriver/src/stdafx.h b/plugins/Scriver/src/stdafx.h index 45fd0c664f..62c24c9887 100644 --- a/plugins/Scriver/src/stdafx.h +++ b/plugins/Scriver/src/stdafx.h @@ -70,8 +70,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct CMPlugin : public PLUGIN { + HANDLE hLogger; + CMOption bSavePerContact, bCascade, bStayMinimized, bAutoMin, bSaveDrafts, bDelTemp, bHideContainer, bAutoPopup; - CMOption bUseIeview, bUseTransparency, bTopmost, bAutoClose, bTypingNew, bTypingUnknown; + CMOption bUseTransparency, bTopmost, bAutoClose, bTypingNew, bTypingUnknown; CMOption bShowTitleBar, bShowStatusBar, bShowToolBar, bShowInfoBar; CMOption bShowAvatar, bShowProgress, bShowIcons, bShowTime, bShowSeconds, bShowDate, bLongDate, bRelativeDate; CMOption bGroupMessages, bMarkFollowups, bMsgOnNewline, bDrawLines, bHideNames, bIndentText; @@ -124,6 +126,8 @@ int OptInitialise(WPARAM wParam, LPARAM lParam); int FontServiceFontsChanged(WPARAM wParam, LPARAM lParam); int StatusIconPressed(WPARAM wParam, LPARAM lParam); +CSrmmLogWindow *logBuilder(CMsgDialog &pDlg); + #include "cmdlist.h" #include "sendqueue.h" #include "globals.h" diff --git a/plugins/Scriver/src/tabs.cpp b/plugins/Scriver/src/tabs.cpp index d8b7ea07dc..d12206e9e4 100644 --- a/plugins/Scriver/src/tabs.cpp +++ b/plugins/Scriver/src/tabs.cpp @@ -196,7 +196,7 @@ void ParentWindowData::ActivateChild(CMsgDialog *pDlg) pDlg->UpdateTitle(); SendMessage(m_hwndActive, WM_SIZE, 0, 0); ShowWindow(m_hwndActive, SW_SHOWNOACTIVATE); - pDlg->ScrollToBottom(); + pDlg->m_pLog->ScrollToBottom(); if (hwndPrev != nullptr) ShowWindow(hwndPrev, SW_HIDE); } -- cgit v1.2.3