From 290518a76e3dbed5f3452f9e210c90246c8875d4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 8 Jun 2018 19:44:51 +0300 Subject: merge of recent SRMM-related fixes --- plugins/Scriver/src/msgdialog.cpp | 57 ++++++++------- plugins/Scriver/src/msglog.cpp | 2 +- plugins/Scriver/src/msgs.h | 52 +++++++------- plugins/Scriver/src/tabs.cpp | 2 +- plugins/Scriver/src/version.h | 2 +- plugins/SmileyAdd/SmileyAdd.vcxproj | 3 + plugins/SmileyAdd/SmileyAdd.vcxproj.filters | 104 ++++++++++++++++++++++++++++ plugins/SmileyAdd/res/resource.rc | 10 +-- plugins/SmileyAdd/src/dlgboxsubclass.cpp | 57 ++------------- plugins/SmileyAdd/src/options.cpp | 13 ---- plugins/SmileyAdd/src/options.h | 3 +- plugins/SmileyAdd/src/resource.h | 5 +- plugins/SmileyAdd/src/stdafx.h | 1 - plugins/SmileyAdd/src/version.h | 4 +- src/core/stdmsg/src/chat_manager.cpp | 6 +- src/core/stdmsg/src/chat_options.cpp | 10 +-- src/core/stdmsg/src/chat_window.cpp | 5 +- src/core/stdmsg/src/globals.h | 2 + src/core/stdmsg/src/msgdialog.cpp | 8 +-- src/core/stdmsg/src/msglog.cpp | 33 +++++++++ src/core/stdmsg/src/msgs.cpp | 3 +- src/core/stdmsg/src/stdafx.h | 1 - 22 files changed, 228 insertions(+), 155 deletions(-) diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 06ca2fe422..8ab31e05aa 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -660,6 +660,33 @@ void CSrmmWindow::NotifyTyping(int mode) CallService(MS_PROTO_SELFISTYPING, m_hContact, m_nTypeMode); } +void CSrmmWindow::ScrollToBottom() +{ + if (m_hwndIeview != nullptr) { + IEVIEWWINDOW ieWindow; + ieWindow.cbSize = sizeof(IEVIEWWINDOW); + 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); + } + } + RedrawWindow(m_log.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); + } +} + void CSrmmWindow::SetDialogToType() { BOOL showToolbar = SendMessage(m_hwndParent, CM_GETTOOLBARSTATUS, 0, 0); @@ -1378,36 +1405,6 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) InvalidateRect(m_log.GetHwnd(), nullptr, FALSE); break; - case DM_APPENDTOLOG: //takes wParam=hDbEvent - StreamInEvents(wParam, 1, 1); - break; - - case DM_SCROLLLOGTOBOTTOM: - if (m_hwndIeview == nullptr) { - if ((GetWindowLongPtr(m_log.GetHwnd(), GWL_STYLE) & WS_VSCROLL) == 0) - break; - - 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); - } - } - RedrawWindow(m_log.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); - } - else { - IEVIEWWINDOW ieWindow; - ieWindow.cbSize = sizeof(IEVIEWWINDOW); - ieWindow.iType = IEW_SCROLLBOTTOM; - ieWindow.hwnd = m_hwndIeview; - CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); - } - break; - case HM_DBEVENTADDED: if (wParam == m_hContact) { MEVENT hDbEvent = lParam; diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index f594b637c1..439a585112 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -836,7 +836,7 @@ void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend) m_log.SendMsg(WM_SETREDRAW, TRUE, 0); m_hDbEventLast = streamData.hDbEventLast; - PostMessage(m_hwnd, DM_SCROLLLOGTOBOTTOM, 0, 0); + ScrollToBottom(); } #define RTFPICTHEADERMAXSIZE 78 diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 5abab8fe59..8950709813 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -86,9 +86,9 @@ protected: int InputAreaShortcuts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); public: - virtual void CloseTab() override; - virtual void LoadSettings() override; - virtual void SetStatusText(const wchar_t*, HICON) override; + void CloseTab() override; + void LoadSettings() override; + void SetStatusText(const wchar_t*, HICON) override; bool IsActive() const { @@ -110,8 +110,8 @@ class CSrmmWindow : public CScriverWindow CCtrlButton m_btnOk, m_btnAdd, m_btnUserMenu, m_btnQuote, m_btnDetails; CSplitter m_splitter; - virtual LRESULT WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam); - virtual LRESULT WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam); bool m_bIncoming, m_bShowTyping; @@ -162,13 +162,14 @@ public: public: CSrmmWindow(MCONTACT hContact, bool bIncoming); - virtual void OnInitDialog() override; - virtual void OnDestroy() override; + void OnInitDialog() override; + void OnDestroy() override; - virtual void UpdateStatusBar() override; - virtual void UpdateTitle() override; + void ScrollToBottom() override; + void UpdateStatusBar() override; + void UpdateTitle() override; - virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override; + INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override; void onClick_Ok(CCtrlButton*); void onClick_Add(CCtrlButton*); @@ -192,9 +193,9 @@ class CChatRoomDlg : public CScriverWindow void MessageDialogResize(int w, int h); void TabAutoComplete(void); - virtual LRESULT WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam) override; - virtual LRESULT WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) override; - virtual LRESULT WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam) override; + 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; static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); @@ -205,19 +206,19 @@ class CChatRoomDlg : public CScriverWindow public: CChatRoomDlg(SESSION_INFO *si); - virtual void OnInitDialog() override; - virtual void OnDestroy() override; + void OnInitDialog() override; + void OnDestroy() override; - virtual INT_PTR DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) override; + INT_PTR DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) override; - virtual void RedrawLog() override; - virtual void ScrollToBottom() override; - virtual void ShowFilterMenu() override; - virtual void StreamInEvents(LOGINFO* lin, bool bRedraw) override; - virtual void UpdateNickList() override; - virtual void UpdateOptions() override; - virtual void UpdateStatusBar() override; - virtual void UpdateTitle() override; + void RedrawLog() override; + void ScrollToBottom() override; + void ShowFilterMenu() override; + void StreamInEvents(LOGINFO* lin, bool bRedraw) override; + void UpdateNickList() override; + void UpdateOptions() override; + void UpdateStatusBar() override; + void UpdateTitle() override; void onChange_Message(CCtrlEdit*); @@ -237,7 +238,6 @@ public: #define DM_OPTIONSAPPLIED (WM_USER+14) #define DM_APPENDTOLOG (WM_USER+17) #define DM_ERRORDECIDED (WM_USER+18) -#define DM_SCROLLLOGTOBOTTOM (WM_USER+19) #define DM_TYPING (WM_USER+20) #define DM_UPDATELASTMESSAGE (WM_USER+22) #define DM_USERNAMETOCLIP (WM_USER+23) @@ -282,7 +282,7 @@ class CErrorDlg : public CDlgBase CCtrlButton m_btnOk, m_btnCancel; protected: - virtual void OnInitDialog() override; + void OnInitDialog() override; public: CErrorDlg(const wchar_t *pwszDescr, HWND, MessageSendQueueItem*); diff --git a/plugins/Scriver/src/tabs.cpp b/plugins/Scriver/src/tabs.cpp index 47208794a9..3f4dd2db88 100644 --- a/plugins/Scriver/src/tabs.cpp +++ b/plugins/Scriver/src/tabs.cpp @@ -197,7 +197,7 @@ static void ActivateChild(ParentWindowData *dat, HWND child) pDlg->UpdateTitle(); SendMessage(dat->hwndActive, WM_SIZE, 0, 0); ShowWindow(dat->hwndActive, SW_SHOWNOACTIVATE); - SendMessage(dat->hwndActive, DM_SCROLLLOGTOBOTTOM, 0, 0); + pDlg->ScrollToBottom(); if (prev != nullptr) ShowWindow(prev, SW_HIDE); } diff --git a/plugins/Scriver/src/version.h b/plugins/Scriver/src/version.h index fc56d643d5..2da3d6bb5b 100644 --- a/plugins/Scriver/src/version.h +++ b/plugins/Scriver/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 3 #define __MINOR_VERSION 0 #define __RELEASE_NUM 1 -#define __BUILD_NUM 8 +#define __BUILD_NUM 9 #include diff --git a/plugins/SmileyAdd/SmileyAdd.vcxproj b/plugins/SmileyAdd/SmileyAdd.vcxproj index 87eb21f46b..ad138c55fd 100644 --- a/plugins/SmileyAdd/SmileyAdd.vcxproj +++ b/plugins/SmileyAdd/SmileyAdd.vcxproj @@ -35,6 +35,9 @@ {5D14CFF3-0D17-4528-99EA-DE9DCA47CC2E} + + + 4458;%(DisableSpecificWarnings) diff --git a/plugins/SmileyAdd/SmileyAdd.vcxproj.filters b/plugins/SmileyAdd/SmileyAdd.vcxproj.filters index de5ad9f66c..3444de9894 100644 --- a/plugins/SmileyAdd/SmileyAdd.vcxproj.filters +++ b/plugins/SmileyAdd/SmileyAdd.vcxproj.filters @@ -1,4 +1,108 @@  + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + Resource Files + + + + + Resource Files + + \ No newline at end of file diff --git a/plugins/SmileyAdd/res/resource.rc b/plugins/SmileyAdd/res/resource.rc index 27357ba49b..4d0e2c94c6 100644 --- a/plugins/SmileyAdd/res/resource.rc +++ b/plugins/SmileyAdd/res/resource.rc @@ -13,7 +13,7 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// Нейтральный resources +// Neutral resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL @@ -67,9 +67,8 @@ BEGIN CONTROL "Enable smileys",IDC_INPUTSMILEYS,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,15,226,130,8 CONTROL "Don't replace at cursor",IDC_DCURSORSMILEY,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,15,237,130,8 GROUPBOX "Built-in message dialog support",IDC_STATIC,155,213,162,36 - CONTROL "Enable",IDC_PLUGENABLED,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,240,222,69,12 - COMBOBOX IDC_SMLBUT,159,233,60,35,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Smiley button",IDC_STATIC,161,223,72,8 + LTEXT "Smiley button",IDC_STATIC,161,226,72,8 + COMBOBOX IDC_SMLBUT,249,226,60,35,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP CONTROL "Surround inserted smiley with spaces",IDC_APPENDSPACES, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,170,220,11 CONTROL "Use first smiley for selection size",IDC_SCALEALLSMILEYS, @@ -107,6 +106,7 @@ END // remains consistent on all systems. IDI_SMILINGICON ICON "smiley.ICO" + #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // @@ -132,7 +132,7 @@ END #endif // APSTUDIO_INVOKED -#endif // Нейтральный resources +#endif // Neutral resources ///////////////////////////////////////////////////////////////////////////// diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp index 884b323837..e082e5f94e 100644 --- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp +++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp @@ -50,8 +50,6 @@ struct MsgWndData : public MZeroedObject bbd.pszModuleName = MODULENAME; if (!doSmileyButton) bbd.bbbFlags = BBBF_DISABLED; - else if (!opt.PluginSupportEnabled) - bbd.bbbFlags = BBBF_HIDDEN; Srmm_SetButtonState(hContact, &bbd); } }; @@ -86,59 +84,18 @@ static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, if (dat == nullptr) return 0; - switch (uMsg) { - case DM_OPTIONSAPPLIED: + if (uMsg == DM_OPTIONSAPPLIED) dat->CreateSmileyButton(); - break; - - case DM_APPENDTOLOG: - if (opt.PluginSupportEnabled) { - // get length of text now before things can get added... - GETTEXTLENGTHEX gtl; - gtl.codepage = 1200; - gtl.flags = GTL_PRECISE | GTL_NUMCHARS; - dat->idxLastChar = (int)SendMessage(dat->hwndLog, EM_GETTEXTLENGTHEX, (WPARAM)>l, 0); - } - break; - } LRESULT result = mir_callNextSubclass(hwnd, MessageDlgSubclass, uMsg, wParam, lParam); - if (!opt.PluginSupportEnabled) - return result; - - switch (uMsg) { - case WM_DESTROY: - { - mir_cslock lck(csWndList); - int ind = g_MsgWndList.getIndex((MsgWndData*)&hwnd); - if (ind != -1) { - delete g_MsgWndList[ind]; - g_MsgWndList.remove(ind); - } - } - break; - case DM_APPENDTOLOG: - if (dat->doSmileyReplace) { - SmileyPackCType *smcp; - SmileyPackType *SmileyPack = GetSmileyPack(dat->ProtocolName, dat->hContact, &smcp); - if (SmileyPack != nullptr) { - const CHARRANGE sel = { dat->idxLastChar, LONG_MAX }; - ReplaceSmileys(dat->hwndLog, SmileyPack, smcp, sel, false, false, false); - } + if (uMsg == WM_DESTROY) { + mir_cslock lck(csWndList); + int ind = g_MsgWndList.getIndex((MsgWndData*)&hwnd); + if (ind != -1) { + delete g_MsgWndList[ind]; + g_MsgWndList.remove(ind); } - break; - - case DM_REMAKELOG: - if (dat->doSmileyReplace) { - SmileyPackCType *smcp; - SmileyPackType *SmileyPack = GetSmileyPack(dat->ProtocolName, dat->hContact, &smcp); - if (SmileyPack != nullptr) { - static const CHARRANGE sel = { 0, LONG_MAX }; - ReplaceSmileys(dat->hwndLog, SmileyPack, smcp, sel, false, false, false); - } - } - break; } return result; diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index de31cf1b8a..4708ccf2dc 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -104,14 +104,6 @@ BOOL OptionsDialogType::DialogProcedure(UINT msg, WPARAM wParam, LPARAM lParam) } break; - case IDC_PLUGENABLED: - if (HIWORD(wParam) == BN_CLICKED) { - BOOL en = IsDlgButtonChecked(m_hwndDialog, IDC_PLUGENABLED) == BST_CHECKED; - EnableWindow(GetDlgItem(m_hwndDialog, IDC_SMLBUT), en); - SetChanged(); - } - break; - case IDC_ADDCATEGORY: if (HIWORD(wParam) == BN_CLICKED) AddCategory(); @@ -350,7 +342,6 @@ void OptionsDialogType::InitDialog(void) { TranslateDialogDefault(m_hwndDialog); - CheckDlgButton(m_hwndDialog, IDC_PLUGENABLED, opt.PluginSupportEnabled ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(m_hwndDialog, IDC_SPACES, opt.EnforceSpaces ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(m_hwndDialog, IDC_SCALETOTEXTHEIGHT, opt.ScaleToTextheight ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(m_hwndDialog, IDC_USESTDPACK, opt.UseOneForAll ? BST_UNCHECKED : BST_CHECKED); @@ -370,7 +361,6 @@ void OptionsDialogType::InitDialog(void) SendDlgItemMessage(m_hwndDialog, IDC_SMLBUT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Show")); SendDlgItemMessage(m_hwndDialog, IDC_SMLBUT, CB_SETCURSEL, opt.ButtonStatus, 0); - EnableWindow(GetDlgItem(m_hwndDialog, IDC_SMLBUT), opt.PluginSupportEnabled); EnableWindow(GetDlgItem(m_hwndDialog, IDC_USEPHYSPROTO), !opt.UseOneForAll); SendDlgItemMessage(m_hwndDialog, IDC_MAXCUSTSPIN, UDM_SETRANGE32, 0, 99); @@ -420,7 +410,6 @@ void OptionsDialogType::ApplyChanges(void) ProcessAllInputAreas(true); CloseSmileys(); - opt.PluginSupportEnabled = IsDlgButtonChecked(m_hwndDialog, IDC_PLUGENABLED) == BST_CHECKED; opt.EnforceSpaces = IsDlgButtonChecked(m_hwndDialog, IDC_SPACES) == BST_CHECKED; opt.ScaleToTextheight = IsDlgButtonChecked(m_hwndDialog, IDC_SCALETOTEXTHEIGHT) == BST_CHECKED; opt.UseOneForAll = IsDlgButtonChecked(m_hwndDialog, IDC_USESTDPACK) == BST_UNCHECKED; @@ -543,7 +532,6 @@ void OptionsDialogType::ShowSmileyPreview(void) void OptionsType::Save(void) { - db_set_b(NULL, MODULENAME, "PluginSupportEnabled", PluginSupportEnabled); db_set_b(NULL, MODULENAME, "EnforceSpaces", EnforceSpaces); db_set_b(NULL, MODULENAME, "ScaleToTextheight", ScaleToTextheight); db_set_b(NULL, MODULENAME, "UseOneForAll", UseOneForAll); @@ -565,7 +553,6 @@ void OptionsType::Save(void) void OptionsType::Load(void) { - PluginSupportEnabled = db_get_b(NULL, MODULENAME, "PluginSupportEnabled", TRUE) != 0; EnforceSpaces = db_get_b(NULL, MODULENAME, "EnforceSpaces", FALSE) != 0; ScaleToTextheight = db_get_b(NULL, MODULENAME, "ScaleToTextheight", FALSE) != 0; UseOneForAll = db_get_b(NULL, MODULENAME, "UseOneForAll", TRUE) != 0; diff --git a/plugins/SmileyAdd/src/options.h b/plugins/SmileyAdd/src/options.h index 130493177e..7ffa3f0b94 100644 --- a/plugins/SmileyAdd/src/options.h +++ b/plugins/SmileyAdd/src/options.h @@ -26,7 +26,6 @@ int SmileysOptionsInitialize(WPARAM wParam, LPARAM lParam); class OptionsType { public: - bool PluginSupportEnabled; bool EnforceSpaces; bool ScaleToTextheight; bool UseOneForAll; @@ -39,7 +38,7 @@ public: bool InputSmileys; bool DCursorSmiley; bool DisableCustom; - bool HQScaling; + bool HQScaling; bool HorizontalSorting; unsigned ButtonStatus; unsigned SelWndBkgClr; diff --git a/plugins/SmileyAdd/src/resource.h b/plugins/SmileyAdd/src/resource.h index 98bf81d17e..533c9326ee 100644 --- a/plugins/SmileyAdd/src/resource.h +++ b/plugins/SmileyAdd/src/resource.h @@ -1,11 +1,10 @@ //{{NO_DEPENDENCIES}} -// Включаемый файл, созданный в Microsoft Visual C++. -// Используется D:\Others\SVN\MirandaNG\trunk\plugins\SmileyAdd\res\resource.rc +// Microsoft Visual C++ generated include file. +// Used by w:\miranda-ng\plugins\SmileyAdd\res\resource.rc // #define IDI_SMILINGICON 124 #define IDD_OPT_SMILEYS 245 #define IDC_CATEGORYLIST 1017 -#define IDC_PLUGENABLED 1019 #define IDC_INPUTSMILEYS 1020 #define IDC_DCURSORSMILEY 1021 #define IDC_LIBNAME 1023 diff --git a/plugins/SmileyAdd/src/stdafx.h b/plugins/SmileyAdd/src/stdafx.h index db2cc70b63..996aebe9a4 100644 --- a/plugins/SmileyAdd/src/stdafx.h +++ b/plugins/SmileyAdd/src/stdafx.h @@ -99,7 +99,6 @@ extern LIST menuHandleArray; #define DM_REMAKELOG (WM_USER + 11) #define DM_OPTIONSAPPLIED (WM_USER + 14) -#define DM_APPENDTOLOG (WM_USER + 17) #define WM_REMAKERICH (WM_USER + 0x3457) diff --git a/plugins/SmileyAdd/src/version.h b/plugins/SmileyAdd/src/version.h index 486043ea5f..9c84ae074d 100644 --- a/plugins/SmileyAdd/src/version.h +++ b/plugins/SmileyAdd/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 3 -#define __RELEASE_NUM 0 -#define __BUILD_NUM 2 +#define __RELEASE_NUM 1 +#define __BUILD_NUM 0 #include diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp index 288c306ec3..3a79ce73b2 100644 --- a/src/core/stdmsg/src/chat_manager.cpp +++ b/src/core/stdmsg/src/chat_manager.cpp @@ -59,8 +59,6 @@ CHAT_MANAGER *pci; HMENU g_hMenu = nullptr; -BOOL SmileyAddInstalled = FALSE, PopupInstalled = FALSE; - GlobalLogSettings g_Settings; static void OnDestroyModule(MODULEINFO *mi) @@ -222,8 +220,8 @@ static void ShowRoom(SESSION_INFO *si) int OnCheckPlugins(WPARAM, LPARAM) { - SmileyAddInstalled = ServiceExists(MS_SMILEYADD_REPLACESMILEYS); - PopupInstalled = ServiceExists(MS_POPUP_ADDPOPUPT); + g_dat.bSmileyInstalled = ServiceExists(MS_SMILEYADD_REPLACESMILEYS); + g_dat.bPopupInstalled = ServiceExists(MS_POPUP_ADDPOPUPT); return 0; } diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp index 9d7080484b..4b396581f9 100644 --- a/src/core/stdmsg/src/chat_options.cpp +++ b/src/core/stdmsg/src/chat_options.cpp @@ -327,7 +327,7 @@ class COptMainDlg : public CDlgBase CheckHeading(hListHeading3); CheckHeading(hListHeading4); CheckHeading(hListHeading5); - if (PopupInstalled) + if (g_dat.bPopupInstalled) CheckHeading(hListHeading6); } @@ -355,7 +355,7 @@ public: FillBranch(hListHeading4, branch4, _countof(branch4), 0x0000); FillBranch(hListHeading5, branch5, _countof(branch5), 0x1000); - if (PopupInstalled) { + if (g_dat.bPopupInstalled) { hListHeading6 = InsertBranch(LPGEN("Popups to display"), db_get_b(0, CHAT_MODULE, "Branch6Exp", 0) ? TRUE : FALSE); FillBranch(hListHeading6, branch6, _countof(branch6), 0x0000); } @@ -369,7 +369,7 @@ public: SaveBranch(branch3, _countof(branch3)); SaveBranch(branch4, _countof(branch4)); SaveBranch(branch5, _countof(branch5)); - if (PopupInstalled) + if (g_dat.bPopupInstalled) SaveBranch(branch6, _countof(branch6)); pci->ReloadSettings(); @@ -389,7 +389,7 @@ public: b = checkBoxes.GetItemState(hListHeading5, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0; db_set_b(0, CHAT_MODULE, "Branch5Exp", b); - if (PopupInstalled) { + if (g_dat.bPopupInstalled) { b = checkBoxes.GetItemState(hListHeading6, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0; db_set_b(0, CHAT_MODULE, "Branch6Exp", b); } @@ -676,7 +676,7 @@ int ChatOptionsInitialize(WPARAM wParam) odp.pDialog = new COptLogDlg(); Options_AddPage(wParam, &odp); - if (PopupInstalled) { + if (g_dat.bPopupInstalled) { odp.position = 910000002; odp.szTitle.a = LPGEN("Chat"); odp.szGroup.a = LPGEN("Popups"); diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 5df7a4fb4f..8083576333 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -369,7 +369,8 @@ void CChatRoomDlg::UpdateTitle() break; } - SetWindowText(m_pOwner->GetHwnd(), szTemp); + if (this == m_pOwner->CurrPage()) + SetWindowText(m_pOwner->GetHwnd(), szTemp); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -436,7 +437,7 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, bool bRedraw) m_log.SendMsg(EM_STREAMIN, wp, (LPARAM)&stream); // do smileys - if (SmileyAddInstalled && (bRedraw || (lin->ptszText && lin->iType != GC_EVENT_JOIN && lin->iType != GC_EVENT_NICK && lin->iType != GC_EVENT_ADDSTATUS && lin->iType != GC_EVENT_REMOVESTATUS))) { + if (g_dat.bSmileyInstalled && (bRedraw || (lin->ptszText && lin->iType != GC_EVENT_JOIN && lin->iType != GC_EVENT_NICK && lin->iType != GC_EVENT_ADDSTATUS && lin->iType != GC_EVENT_REMOVESTATUS))) { CHARRANGE newsel; newsel.cpMax = -1; newsel.cpMin = sel.cpMin; diff --git a/src/core/stdmsg/src/globals.h b/src/core/stdmsg/src/globals.h index 78148da5cd..0c4d9d3205 100644 --- a/src/core/stdmsg/src/globals.h +++ b/src/core/stdmsg/src/globals.h @@ -64,6 +64,8 @@ struct GlobalMessageData CMOption iLoadHistory; CMOption nLoadCount, nLoadTime; + + bool bSmileyInstalled = false, bPopupInstalled = false; }; void InitGlobals(); diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 90029de1c6..3fb5a62086 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -1195,13 +1195,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break; case WM_TIMER: - if (wParam == TIMERID_FLASHWND) { - if (m_nFlash > 2 * g_dat.nFlashMax) { - StopFlash(); - return 0; - } - } - else if (wParam == TIMERID_TYPE) { + if (wParam == TIMERID_TYPE) { ShowTime(false); if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON && GetTickCount() - m_nLastTyping > TIMEOUT_TYPEOFF) NotifyTyping(PROTOTYPE_SELFTYPING_OFF); diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index b06bdb9b64..c3527c5660 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -425,9 +425,21 @@ void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, bool bAppend) if (!bottomScroll) m_log.SendMsg(EM_GETSCROLLPOS, 0, (LPARAM)&scrollPos); } + + FINDTEXTEXA fi; if (bAppend) { sel.cpMin = sel.cpMax = -1; m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); + fi.chrg.cpMin = 0; + } + else { + 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); } mir_strcpy(szSep2, bAppend ? "\\par\\sl0" : "\\sl1000"); @@ -444,6 +456,27 @@ void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, bool bAppend) m_log.SendMsg(EM_SETSCROLLPOS, 0, (LPARAM)&scrollPos); } + if (g_dat.bSmileyInstalled) { + 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) RedrawWindow(m_log.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index e94b2386b5..6e08f26fc2 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -53,7 +53,8 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_TIMER: if (wParam == TIMERID_FLASHWND) { m_pOwner->FixTabIcons(this); - FlashWindow(m_pOwner->GetHwnd(), TRUE); + if (m_nFlash < 2 * g_dat.nFlashMax) + FlashWindow(m_pOwner->GetHwnd(), TRUE); m_nFlash++; } break; diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index 3baa9a50a5..9cfeb98d6d 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -113,7 +113,6 @@ extern GlobalLogSettings g_Settings; extern HMENU g_hMenu; extern HINSTANCE g_hInst; -extern BOOL SmileyAddInstalled, PopupInstalled; // main.cpp void LoadIcons(void); -- cgit v1.2.3