Quellcode durchsuchen

show tooltips and snap correctly on multiple monitors and hide manually activated toolip when window pos changes -- SAB

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@50 595ec19a-5cb4-439b-94a8-42fb3063c22c
sabrogden vor 22 Jahren
Ursprung
Commit
6659ba6b0f
4 geänderte Dateien mit 19 neuen und 12 gelöschten Zeilen
  1. 4 3
      Misc.cpp
  2. 7 6
      QListCtrl.cpp
  3. 1 0
      QListCtrl.h
  4. 7 3
      QPasteWnd.cpp

+ 4 - 3
Misc.cpp

@@ -1535,9 +1535,10 @@ void CPopup::Init()
 	m_bCenterY = false;
 	m_hWndPosRelativeTo = NULL;
 
-RECT rcScreen;
-	// Get cordinates of the working area on the screen
-	SystemParametersInfo (SPI_GETWORKAREA, 0, &rcScreen, 0);
+	RECT rcScreen;
+		
+	GetMonitorRect(-1, &rcScreen);
+
 	m_ScreenMaxX = rcScreen.right;
 	m_ScreenMaxY = rcScreen.bottom;
 

+ 7 - 6
QListCtrl.cpp

@@ -109,9 +109,10 @@ BEGIN_MESSAGE_MAP(CQListCtrl, CListCtrl)
 	ON_WM_CREATE()
 	ON_WM_VSCROLL()
 	ON_WM_HSCROLL()
-	ON_NOTIFY_REFLECT(LVN_ITEMCHANGED, OnSelectionChange)
 	ON_WM_TIMER()
 	ON_WM_WINDOWPOSCHANGED()
+	ON_NOTIFY_REFLECT(LVN_ITEMCHANGED, OnSelectionChange)
+	ON_WM_SIZE()
 	//}}AFX_MSG_MAP
 	ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText)
 	ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText)
@@ -848,9 +849,9 @@ void CQListCtrl::OnTimer(UINT nIDEvent)
 void CQListCtrl::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos) 
 {
 	CListCtrl::OnWindowPosChanged(lpwndpos);
-	
-	if(m_Popup.m_bIsShowing)
-	{
-		m_Popup.Hide();
-	}
+}
+
+void CQListCtrl::OnSize(UINT nType, int cx, int cy) 
+{
+	CListCtrl::OnSize(nType, cx, cy);
 }

+ 1 - 0
QListCtrl.h

@@ -115,6 +115,7 @@ protected:
 	afx_msg void OnTimer(UINT nIDEvent);
 	afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
 	afx_msg void OnSelectionChange(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnSize(UINT nType, int cx, int cy);
 	//}}AFX_MSG
 	afx_msg BOOL OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult );
 	DECLARE_MESSAGE_MAP()

+ 7 - 3
QPasteWnd.cpp

@@ -1454,11 +1454,15 @@ void CQPasteWnd::OnWindowPosChanging(WINDOWPOS* lpwndpos)
 {
 	CWndEx::OnWindowPosChanging(lpwndpos);
 
-	RECT rcScreen;
+	if(m_lstHeader.m_Popup.m_bIsShowing)
+		m_lstHeader.m_Popup.Hide();
 
-	// Get cordinates of the working area on the screen
-	SystemParametersInfo (SPI_GETWORKAREA, 0, &rcScreen, 0);
+	CRect rcScreen;
 
+	CRect cr(lpwndpos->x, lpwndpos->y, lpwndpos->x + lpwndpos->cx, lpwndpos->y + lpwndpos->cy);
+	int nMonitor = GetMonitorFromRect(&cr);
+	GetMonitorRect(nMonitor, &rcScreen);
+	
 	// Snap X axis to left
 	if(abs(lpwndpos->x - rcScreen.left) <= WNDSNAP_ALLOWANCE)
 	{