summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-17 20:43:27 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-17 20:43:27 +0000
commitd455326ddad52ed872927a67eea82fa6cd102fa3 (patch)
treef6a9d4f056fe9c143b6399c4baf5a25976b6de3e /plugins/TabSRMM/src
parentb1d1c1adee5a98a6f048b44fb61105d17f8de7e8 (diff)
patch for valid coordinates calculation in tabsrmm info panel
git-svn-id: http://svn.miranda-ng.org/main/trunk@2342 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/include/infopanel.h158
-rw-r--r--plugins/TabSRMM/src/infopanel.cpp18
2 files changed, 95 insertions, 81 deletions
diff --git a/plugins/TabSRMM/src/include/infopanel.h b/plugins/TabSRMM/src/include/infopanel.h
index 3a2812444e..f7513b8930 100644
--- a/plugins/TabSRMM/src/include/infopanel.h
+++ b/plugins/TabSRMM/src/include/infopanel.h
@@ -88,25 +88,25 @@ public:
static void registerClass ();
private:
- INT_PTR CALLBACK WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK WndProcStub (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK RichEditProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
- HWND m_hwnd; // our window handle
- HWND m_hRich; // handle of the rich edit child
- HWND m_hwndParent; // parent window (used for position calculations and to send notifications)
- HANDLE m_hContact; // contact handle
- char* m_pszText; // the richedit text
- SIZE m_szRich; // size of the richedit control (height auto-calculated to make it fit the text)
- RECT m_rcRich; // adjusted rectangle for the richedit control (client coordinates)
- const CInfoPanel* m_panel; // the info panel parent (if any)
- HICON m_hIcon; // optional icon to show in the title line
- const TCHAR* m_szTitle; // optional text to show in the title
- int m_leftWidth;
+ INT_PTR CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static INT_PTR CALLBACK WndProcStub(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static INT_PTR CALLBACK RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+
+ HWND m_hwnd; // our window handle
+ HWND m_hRich; // handle of the rich edit child
+ HWND m_hwndParent; // parent window (used for position calculations and to send notifications)
+ HANDLE m_hContact; // contact handle
+ char *m_pszText; // the richedit text
+ SIZE m_szRich; // size of the richedit control (height auto-calculated to make it fit the text)
+ RECT m_rcRich; // adjusted rectangle for the richedit control (client coordinates)
+ HICON m_hIcon; // optional icon to show in the title line
+ LPCTSTR m_szTitle; // optional text to show in the title
+ int m_leftWidth;
+
+ const CInfoPanel *m_panel; // the info panel parent (if any)
private:
- static WNDPROC m_OldMessageEditProc; // stores original richedit wnd proc
-
+ static WNDPROC m_OldMessageEditProc; // stores original richedit wnd proc
};
/**
@@ -123,16 +123,17 @@ public:
LEFT_OFFSET_LOGO = 3
};
enum {
- HOVER_NICK = 1,
- HOVER_STATUS = 2,
- HOVER_UIN = 4
+ HOVER_NICK = 1,
+ HOVER_STATUS = 2,
+ HOVER_UIN = 4
};
enum {
- HTNICK = 1,
- HTUIN = 2,
- HTSTATUS = 3,
- HTNIRVANA = 0
+ HTNICK = 1,
+ HTUIN = 2,
+ HTSTATUS = 3,
+ HTNIRVANA = 0
};
+
CInfoPanel(TWindowData *dat)
{
if (dat) {
@@ -153,68 +154,71 @@ public:
saveHeight(true);
}
- const LONG getHeight () const { return(m_height); }
- void setHeight (LONG newHeight, bool fBroadcast = false);
- bool isActive () const { return(m_active); }
- bool isPrivateHeight () const { return(m_fPrivateHeight); }
- DWORD isHovered () const { return(m_active ? m_hoverFlags : 0); }
- const TWindowData* getDat () const { return(m_dat); }
- void setActive (const int newActive);
- void loadHeight ();
- void saveHeight (bool fFlush = false);
-
- void Configure () const;
- void showHide () const;
- bool getVisibility ();
- void renderBG (const HDC hdc, RECT& rc, CSkinItem *item, bool fAero, bool fAutoCalc = true) const;
- void renderContent (const HDC hdcMem);
- void Invalidate (BOOL fErase = FALSE) const;
- void trackMouse (POINT& pt);
- int hitTest (POINT pt);
- void handleClick (const POINT& pt);
- void showTip (UINT ctrlId, const LPARAM lParam);
- void hideTip (const HWND hWndNew);
- int invokeConfigDialog (const POINT& pt);
- void dismissConfig (bool fForced = false);
+ __forceinline const LONG getHeight() const { return m_height; }
+ __forceinline bool isActive() const { return m_active; }
+ __forceinline bool isPrivateHeight() const { return m_fPrivateHeight; }
+ __forceinline DWORD isHovered() const { return m_active ? m_hoverFlags : 0; }
+ __forceinline const TWindowData* getDat() const { return m_dat; }
+
+ void setHeight(LONG newHeight, bool fBroadcast = false);
+ void setActive(const int newActive);
+ void loadHeight();
+ void saveHeight(bool fFlush = false);
+
+ void Configure() const;
+ void showHide() const;
+ bool getVisibility();
+ void renderBG(const HDC hdc, RECT& rc, CSkinItem *item, bool fAero, bool fAutoCalc = true) const;
+ void renderContent(const HDC hdcMem);
+ void Invalidate(BOOL fErase = FALSE) const;
+ void trackMouse(POINT& pt);
+ int hitTest(POINT pt);
+ void handleClick(const POINT& pt);
+ void showTip(UINT ctrlId, const LPARAM lParam);
+ void hideTip(const HWND hWndNew);
+ int invokeConfigDialog(const POINT& pt);
+ void dismissConfig(bool fForced = false);
public:
- static TInfoPanelConfig m_ipConfig;
- static int setPanelHandler (TWindowData *dat, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK avatarParentSubclass (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static TInfoPanelConfig m_ipConfig;
+ static int setPanelHandler(TWindowData *dat, WPARAM wParam, LPARAM lParam);
+ static INT_PTR CALLBACK avatarParentSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
private:
- void mapRealRect (const RECT& rcSrc, RECT& rcDest, const SIZE& sz);
- HFONT setUnderlinedFont (const HDC hdc, HFONT hFontOrig);
- void RenderIPNickname (const HDC hdc, RECT& rc);
- void RenderIPUIN (const HDC hdc, RECT& rcItem);
- void RenderIPStatus (const HDC hdc, RECT& rcItem);
- void Chat_RenderIPNickname (const HDC hdc, RECT& rcItem);
- void Chat_RenderIPSecondLine (const HDC hdc, RECT& rcItem);
- LRESULT cmdHandler (UINT cmd);
- HMENU constructContextualMenu () const;
- INT_PTR CALLBACK ConfigDlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK ConfigDlgProcStub (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ void mapRealRect(const RECT& rcSrc, RECT& rcDest, const SIZE& sz);
+ void mapRealRectOnTop(const RECT& rcSrc, RECT& rcDest, const SIZE& sz);
+ HFONT setUnderlinedFont(const HDC hdc, HFONT hFontOrig);
+ void RenderIPNickname(const HDC hdc, RECT& rc);
+ void RenderIPUIN(const HDC hdc, RECT& rcItem);
+ void RenderIPStatus(const HDC hdc, RECT& rcItem);
+ void Chat_RenderIPNickname(const HDC hdc, RECT& rcItem);
+ void Chat_RenderIPSecondLine(const HDC hdc, RECT& rcItem);
+ HMENU constructContextualMenu() const;
+ LRESULT cmdHandler(UINT cmd);
+ INT_PTR CALLBACK ConfigDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static INT_PTR CALLBACK ConfigDlgProcStub(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
private:
- bool m_isChat; // is MUC session
- bool m_active; // panel active and visible
- bool m_fPrivateHeight;
- bool m_fDialogCreated;
- TWindowData* m_dat; // this one OWNS us...
- LONG m_height; // height (determined by position of IDC_PANELSPLITTER)
- LONG m_defaultHeight, m_defaultMUCHeight; // global values for the info bar height
- HWND m_hwndConfig; // window handle of the config dialog window
- HFONT m_configDlgFont, m_configDlgBoldFont;
- SIZE m_szNick; // rectangle where the nick has been rendered,
+ bool m_isChat; // is MUC session
+ bool m_active; // panel active and visible
+ bool m_fPrivateHeight;
+ bool m_fDialogCreated;
+ TWindowData *m_dat; // this one OWNS us...
+ LONG m_height; // height (determined by position of IDC_PANELSPLITTER)
+ LONG m_defaultHeight,
+ m_defaultMUCHeight; // global values for the info bar height
+ HWND m_hwndConfig; // window handle of the config dialog window
+ HFONT m_configDlgFont,
+ m_configDlgBoldFont;
+ SIZE m_szNick; // rectangle where the nick has been rendered,
/*
* these are used to store rectangles important to mouse tracking.
*/
- RECT m_rcNick;
- RECT m_rcUIN;
- RECT m_rcStatus;
- DWORD m_hoverFlags;
- CTip* m_tip;
+ RECT m_rcNick;
+ RECT m_rcUIN;
+ RECT m_rcStatus;
+ DWORD m_hoverFlags;
+ CTip *m_tip;
};
#endif /* __INFOPANEL_H */
-
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp
index 6b0d85a024..6c7b857a3b 100644
--- a/plugins/TabSRMM/src/infopanel.cpp
+++ b/plugins/TabSRMM/src/infopanel.cpp
@@ -246,6 +246,14 @@ void CInfoPanel::mapRealRect(const RECT& rcSrc, RECT& rcDest, const SIZE& sz)
rcDest.bottom = rcDest.top + sz.cy;
}
+void CInfoPanel::mapRealRectOnTop(const RECT& rcSrc, RECT& rcDest, const SIZE& sz)
+{
+ rcDest.left = rcSrc.left;
+ rcDest.right = rcDest.left + sz.cx;
+ rcDest.top = rcSrc.top;
+ rcDest.bottom = rcDest.top + sz.cy;
+}
+
/**
* create an underlined version of the original font and select it
* in the given device context
@@ -430,9 +438,11 @@ void CInfoPanel::RenderIPNickname(const HDC hdc, RECT& rcItem)
::GetTextExtentPoint32(hdc, _T("A"), 1, &sMask);
::GetTextExtentPoint32(hdc, szStatusMsg, lstrlen(szStatusMsg), &sStatusMsg);
dtFlagsNick = DT_SINGLELINE | DT_WORD_ELLIPSIS | DT_NOPREFIX;
- if ((m_szNick.cx + sStatusMsg.cx + 6) < (rcItem.right - rcItem.left) || (rcItem.bottom - rcItem.top) < (2 * sMask.cy))
+ if ((m_szNick.cx + sStatusMsg.cx + 6) < (rcItem.right - rcItem.left) || (rcItem.bottom - rcItem.top) < (2 * sMask.cy)) {
dtFlagsNick |= DT_VCENTER;
- mapRealRect(rcItem, m_rcNick, m_szNick);
+ mapRealRect(rcItem, m_rcNick, m_szNick);
+ }
+ else mapRealRectOnTop(rcItem, m_rcNick, m_szNick);
if (m_hoverFlags & HOVER_NICK)
setUnderlinedFont(hdc, fShowUin ? m_ipConfig.hFonts[IPFONTID_UIN] : m_ipConfig.hFonts[IPFONTID_NICK]);
@@ -508,7 +518,7 @@ void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem)
int i_hrs = diff / 3600;
int i_mins = (diff - i_hrs * 3600) / 60;
mir_sntprintf(szBuf, safe_sizeof(szBuf), TranslateT("%s Idle: %dh,%02dm"), tszUin, i_hrs, i_mins);
- }
+ }
else _tcscpy_s (szBuf, 256, tszUin);
_tcscat_s(szBuf, 256, temp);
@@ -988,7 +998,7 @@ void CInfoPanel::showTip(UINT ctrlId, const LPARAM lParam)
/**
* hide a tooltip (if it was created)
* 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)