Browse Source

page up/down moves description viewer if it's visible

Scott Brogden 9 years ago
parent
commit
37c8bd1d99
4 changed files with 53 additions and 7 deletions
  1. 13 3
      ImageViewer.cpp
  2. 5 0
      QListCtrl.cpp
  3. 34 4
      ToolTipEx.cpp
  4. 1 0
      ToolTipEx.h

+ 13 - 3
ImageViewer.cpp

@@ -67,10 +67,20 @@ void CImageViewer::UpdateBitmapSize()
 {
 	if (m_pBitmap != NULL)
 	{
-		int nWidth = CBitmapHelper::GetCBitmapWidth(*m_pBitmap);
-		int nHeight = CBitmapHelper::GetCBitmapHeight(*m_pBitmap);
+		if (CGetSetOptions::GetScaleImagesToDescWindow())
+		{
+			CRect rect;
+			GetClientRect(rect);
 
-		m_scrollHelper.SetDisplaySize(nWidth, nHeight);
+			m_scrollHelper.SetDisplaySize(rect.Width(), rect.Height());
+		}
+		else
+		{
+			int nWidth = CBitmapHelper::GetCBitmapWidth(*m_pBitmap);
+			int nHeight = CBitmapHelper::GetCBitmapHeight(*m_pBitmap);
+
+			m_scrollHelper.SetDisplaySize(nWidth, nHeight);
+		}
 	}
 }
 

+ 5 - 0
QListCtrl.cpp

@@ -1234,6 +1234,11 @@ void CQListCtrl::OnSelectionChange(NMHDR* pNMHDR, LRESULT* pResult)
 	if((pnmv->uNewState == 3) ||
 		(pnmv->uNewState == 1))
 	{
+		if (VALID_TOOLTIP &&
+			::IsWindowVisible(m_pToolTip->m_hWnd))
+		{
+			this->ShowFullDescription(false, true);
+		}
 		if(g_Opt.m_bAllwaysShowDescription)
 		{
 			KillTimer(TIMER_SHOW_PROPERTIES);

+ 34 - 4
ToolTipEx.cpp

@@ -36,7 +36,7 @@ CToolTipEx::~CToolTipEx()
 
 BEGIN_MESSAGE_MAP(CToolTipEx, CWnd)
 //{{AFX_MSG_MAP(CToolTipEx)
-
+ON_WM_PAINT()
 ON_WM_SIZE()
 ON_WM_NCHITTEST()
 ON_WM_ACTIVATE()
@@ -113,6 +113,8 @@ BOOL CToolTipEx::Show(CPoint point)
     {
         m_RichEdit.ShowWindow(SW_HIDE);
 		m_imageViewer.ShowWindow(SW_SHOW);
+
+		m_imageViewer.UpdateBitmapSize();
     }
     else
     {
@@ -143,8 +145,8 @@ BOOL CToolTipEx::Show(CPoint point)
 
 		if (m_imageViewer.m_pBitmap)
 		{
-			int nWidth = CBitmapHelper::GetCBitmapWidth(*m_imageViewer.m_pBitmap);
-			int nHeight = CBitmapHelper::GetCBitmapHeight(*m_imageViewer.m_pBitmap);
+			int nWidth = CBitmapHelper::GetCBitmapWidth(*m_imageViewer.m_pBitmap) + ::GetSystemMetrics(SM_CXVSCROLL);
+			int nHeight = CBitmapHelper::GetCBitmapHeight(*m_imageViewer.m_pBitmap) + ::GetSystemMetrics(SM_CYHSCROLL);
 
 			rect.right = rect.left + nWidth;
 			rect.bottom = rect.top + nHeight;
@@ -274,7 +276,8 @@ BOOL CToolTipEx::PreTranslateMessage(MSG *pMsg)
 			break;
 		case WM_RBUTTONDOWN:
 			{
-				if (m_RichEdit.m_hWnd == GetFocus()->m_hWnd)
+				if (m_RichEdit.m_hWnd == GetFocus()->m_hWnd ||
+					m_imageViewer.m_hWnd == GetFocus()->m_hWnd)
 				{
 					OnOptions();
 					return TRUE;
@@ -343,6 +346,14 @@ BOOL CToolTipEx::OnMsg(MSG *pMsg)
 				{
 					return FALSE;
 				}
+				else if(vk == VK_NEXT)
+				{
+					return FALSE;
+				}
+				else if (vk == VK_PRIOR)
+				{
+					return FALSE;
+				}
 
                 Hide();
 
@@ -795,6 +806,7 @@ void CToolTipEx::OnSizewindowtocontent()
 void CToolTipEx::OnScaleimagestofitwindow()
 {
 	CGetSetOptions::SetScaleImagesToDescWindow(!CGetSetOptions::GetScaleImagesToDescWindow());
+	m_imageViewer.UpdateBitmapSize();
 	Invalidate();
 }
 
@@ -812,3 +824,21 @@ void CToolTipEx::OnSetFocus(CWnd* pOldWnd)
 
 	m_RichEdit.SetFocus();
 }
+
+void CToolTipEx::OnPaint()
+{
+	CPaintDC dc(this); // device context for painting
+
+	CRect rect;
+	GetClientRect(rect);
+	
+	CBrush  Brush, *pOldBrush;
+	Brush.CreateSolidBrush(GetSysColor(COLOR_INFOBK));
+
+	pOldBrush = dc.SelectObject(&Brush);
+
+	dc.FillRect(&rect, &Brush);
+
+	// Cleanup
+	dc.SelectObject(pOldBrush);
+}

+ 1 - 0
ToolTipEx.h

@@ -105,6 +105,7 @@ public:
 	afx_msg void OnScaleimagestofitwindow();
 	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
 	afx_msg void OnSetFocus(CWnd* pOldWnd);
+	afx_msg void OnPaint();
 	
 };