From c16bd3d58396036f078282ad0b7032562c0c0533 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 1 Sep 2015 15:18:56 +0000 Subject: - adaptation for the kernel strdel(); - buffer overrun removed (rare crashes); - old useless code removed; - removal of a blank line after comments was a bad idea git-svn-id: http://svn.miranda-ng.org/main/trunk@15136 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/infopanel.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'plugins/TabSRMM/src/infopanel.cpp') diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 6314e59e0e..5b2cccb984 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -74,6 +74,7 @@ void CInfoPanel::setActive(const int newActive) ///////////////////////////////////////////////////////////////////////////////////////// // Load height. Private panel height is indicated by 0xffff for the high word + void CInfoPanel::loadHeight() { BYTE bSync = M.GetByte("syncAllPanels", 0); // sync muc <> im panels @@ -100,6 +101,7 @@ void CInfoPanel::loadHeight() // Save current panel height to the database // // @param fFlush bool: flush values to database (usually only requested by destructor) + void CInfoPanel::saveHeight(bool fFlush) { BYTE bSync = M.GetByte("syncAllPanels", 0); @@ -138,6 +140,7 @@ void CInfoPanel::saveHeight(bool fFlush) // @param newHeight LONG: the new height. // @param fBroadcast bool: broadcast the new height to all open sessions, respect // container's private setting flag. + void CInfoPanel::setHeight(LONG newHeight, bool fBroadcast) { if (newHeight < MIN_PANELHEIGHT || newHeight > 100) @@ -219,6 +222,7 @@ void CInfoPanel::showHide() const // if applicable, local (per contact) override. // // @return bool: panel is visible for this session + bool CInfoPanel::getVisibility() { if (m_dat->hContact == 0) { @@ -257,6 +261,7 @@ void CInfoPanel::mapRealRectOnTop(const RECT& rcSrc, RECT& rcDest, const SIZE& s // returns the previosuly selected font // // caller should not forget to delete the font! + HFONT CInfoPanel::setUnderlinedFont(const HDC hdc, HFONT hFontOrig) { LOGFONT lf; @@ -274,6 +279,7 @@ HFONT CInfoPanel::setUnderlinedFont(const HDC hdc, HFONT hFontOrig) // @param rc RECT&: target rectangle // @param item CSkinItem *: The item to render in non-aero mode // @param bAero bool: aero active + void CInfoPanel::renderBG(const HDC hdc, RECT& rc, CSkinItem *item, bool bAero, bool fAutoCalc) const { if (!m_active) @@ -319,6 +325,7 @@ void CInfoPanel::renderBG(const HDC hdc, RECT& rc, CSkinItem *item, bool bAero, // message window's WM_SIZE handler). // // @param hdc HDC: target device context + void CInfoPanel::renderContent(const HDC hdc) { if (!m_active) @@ -373,6 +380,7 @@ void CInfoPanel::renderContent(const HDC hdc) // @param hdc HDC: target DC for drawing // // @param rcItem RECT &: target rectangle + void CInfoPanel::RenderIPNickname(const HDC hdc, RECT &rcItem) { const TCHAR *szStatusMsg = NULL; @@ -466,6 +474,7 @@ void CInfoPanel::RenderIPNickname(const HDC hdc, RECT &rcItem) // // @param hdc HDC: device context for drawing. // @param rcItem RECT &: target rectangle for drawing + void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem) { ::SetBkMode(hdc, TRANSPARENT); @@ -516,6 +525,7 @@ void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem) ///////////////////////////////////////////////////////////////////////////////////////// // Render the info panel status field. Usually in the 2nd line, right aligned // @param hdc : target device context + void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem) { SIZE sProto = { 0 }, sStatus = { 0 }, sTime = { 0 }; @@ -589,6 +599,7 @@ void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem) // // @param hdc HDC: device context for drawing. // @param rcItem RECT &: target rectangle for drawing + void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem) { SESSION_INFO *si = reinterpret_cast(m_dat->si); @@ -647,6 +658,7 @@ void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem) // Draw 2nd line of text in the info panel. // @param hdc : target device context // @param rcItem : target rectangle + void CInfoPanel::Chat_RenderIPSecondLine(const HDC hdc, RECT& rcItem) { SESSION_INFO *si = reinterpret_cast(m_dat->si); @@ -679,6 +691,7 @@ void CInfoPanel::Chat_RenderIPSecondLine(const HDC hdc, RECT& rcItem) ///////////////////////////////////////////////////////////////////////////////////////// // Invalidate the info panel rectangle + void CInfoPanel::Invalidate(BOOL fErase) const { if (m_active) { @@ -692,6 +705,7 @@ void CInfoPanel::Invalidate(BOOL fErase) const ///////////////////////////////////////////////////////////////////////////////////////// // build the left click contextual menu for the info panel // @return HMENU: menu handle for the fully prepared menu + HMENU CInfoPanel::constructContextualMenu() const { MENUITEMINFO mii = { 0 }; @@ -730,6 +744,7 @@ HMENU CInfoPanel::constructContextualMenu() const // // @param cmd command id // @return 0 if command was processed, != 0 otherwise + LRESULT CInfoPanel::cmdHandler(UINT cmd) { switch (cmd) { @@ -759,6 +774,7 @@ LRESULT CInfoPanel::cmdHandler(UINT cmd) // handle mouse clicks on the info panel. // // @param pt: mouse cursor pos + void CInfoPanel::handleClick(const POINT& pt) { if (!m_active || m_hoverFlags == 0) @@ -786,6 +802,7 @@ void CInfoPanel::handleClick(const POINT& pt) // // @param pt POINT (in screen coordinates) // @return Hit test result or 0 if none applies. + int CInfoPanel::hitTest(POINT pt) { ::ScreenToClient(m_dat->hwnd, &pt); @@ -805,6 +822,7 @@ int CInfoPanel::hitTest(POINT pt) // and to hover the info panel fields. // // @param pt : mouse coordinates (screen) + void CInfoPanel::trackMouse(POINT &pt) { if (!m_active) @@ -848,6 +866,7 @@ void CInfoPanel::trackMouse(POINT &pt) // activate a tooltip // @param ctrlId : control id // @param lParam : typically a TCHAR * for the tooltip text + void CInfoPanel::showTip(UINT ctrlId, const LPARAM lParam) { if (!m_active || !m_dat->hwndTip) @@ -921,6 +940,7 @@ void CInfoPanel::showTip(UINT ctrlId, const LPARAM lParam) // this is only used from outside (i.e. container window dialog) // // hwndNew = window to become active (as reported by WM_ACTIVATE). + void CInfoPanel::hideTip(const HWND hwndNew) { if (m_tip) { @@ -937,6 +957,7 @@ void CInfoPanel::hideTip(const HWND hwndNew) // (ACC window class). Only required when support for animated avatars is enabled because // native avatar rendering does not support animated images. // To avoid clipping issues, this is done during WM_ERASEBKGND. + LRESULT CALLBACK CInfoPanel::avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { @@ -1014,6 +1035,7 @@ LRESULT CALLBACK CInfoPanel::avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wP // our userdata. Real processing is done by ConfigDlgProc() // // @params Like a normal dialog procedure + INT_PTR CALLBACK CInfoPanel::ConfigDlgProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { CInfoPanel *infoPanel = reinterpret_cast(::GetWindowLongPtr(hwnd, GWLP_USERDATA)); @@ -1032,6 +1054,7 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProcStub(HWND hwnd, UINT msg, WPARAM wPara ///////////////////////////////////////////////////////////////////////////////////////// // dialog procedure for the info panel config popup + INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { @@ -1219,6 +1242,7 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L // invoke info panel config popup dialog // @param pt : mouse coordinates (screen) // @return : always 0 + int CInfoPanel::invokeConfigDialog(const POINT &pt) { if (!m_active) @@ -1257,6 +1281,7 @@ int CInfoPanel::invokeConfigDialog(const POINT &pt) // remove the info panel configuration dialog // @param fForced: bool, if true, dismiss it under any circumstances, even // with the pointer still inside the dialog. + void CInfoPanel::dismissConfig(bool fForced) { if (m_hwndConfig == 0) @@ -1283,6 +1308,7 @@ void CInfoPanel::dismissConfig(bool fForced) // @param hContact HANDLE contact handle // @param pszText TCHAR* the content of the rich edit control // @param panel CInfoPanel* the panel which owns it + CTip::CTip(const HWND hwndParent, const MCONTACT hContact, const TCHAR *pszText, const CInfoPanel* panel) { m_hwnd = ::CreateWindowEx(WS_EX_TOOLWINDOW, _T("RichEditTipClass"), _T(""), (M.isAero() ? WS_THICKFRAME : WS_BORDER) | WS_POPUPWINDOW | WS_TABSTOP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, @@ -1312,6 +1338,7 @@ CTip::CTip(const HWND hwndParent, const MCONTACT hContact, const TCHAR *pszText, // @param pt point in screen coordinates // @param hIcon optional icon to display in the tip header // @param szTitle optional title to display in the tip header + void CTip::show(const RECT& rc, POINT& pt, const HICON hIcon, const TCHAR *szTitle) { HDC hdc = ::GetDC(m_hwnd); @@ -1384,6 +1411,7 @@ void CTip::show(const RECT& rc, POINT& pt, const HICON hIcon, const TCHAR *szTit ///////////////////////////////////////////////////////////////////////////////////////// // register richedit tooltip window class + void CTip::registerClass() { WNDCLASSEX wc = { 0 }; @@ -1399,6 +1427,7 @@ void CTip::registerClass() ///////////////////////////////////////////////////////////////////////////////////////// // subclass the rich edit control inside the tip. Needed to hide the blinking // caret and prevent all scrolling actions. + LRESULT CALLBACK CTip::RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { @@ -1424,6 +1453,7 @@ LRESULT CALLBACK CTip::RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l ///////////////////////////////////////////////////////////////////////////////////////// // stub for the tip control window procedure. Just handle WM_CREATE and set the // this pointer. + LRESULT CALLBACK CTip::WndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { CTip *tip = reinterpret_cast(::GetWindowLongPtr(hwnd, GWLP_USERDATA)); @@ -1440,6 +1470,7 @@ LRESULT CALLBACK CTip::WndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP ///////////////////////////////////////////////////////////////////////////////////////// // the window procedure for the tooltip window. + INT_PTR CALLBACK CTip::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { POINT pt; -- cgit v1.2.3