Browse Source

- allow f3 to work when search has focus
- right click menu on description to show options

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@693 595ec19a-5cb4-439b-94a8-42fb3063c22c

sabrogden 11 years ago
parent
commit
b10066959c
5 changed files with 65 additions and 18 deletions
  1. 3 0
      DittoWindow.cpp
  2. 21 9
      QPasteWnd.cpp
  3. 4 1
      QPasteWnd.h
  4. 35 8
      ToolTipEx.cpp
  5. 2 0
      ToolTipEx.h

+ 3 - 0
DittoWindow.cpp

@@ -362,6 +362,9 @@ void CDittoWindow::DoSetRegion(CWnd *pWnd)
 	CRgn rgnRect, rgnRect2, rgnRound, rgnFinalA, rgnFinalB;
 	pWnd->GetWindowRect(rect);
 
+	if(rect.Width() < 0)
+		return;
+
 	CRect r;
 	pWnd->GetClientRect(&r);
 

+ 21 - 9
QPasteWnd.cpp

@@ -2564,18 +2564,25 @@ void CQPasteWnd::SetKeyModiferState(bool bActive)
 
 BOOL CQPasteWnd::PreTranslateMessage(MSG *pMsg)
 {
+	if(CheckActions(pMsg))
+	{
+		return TRUE;
+	}
+
+    return CWndEx::PreTranslateMessage(pMsg);
+}
+
+bool CQPasteWnd::CheckActions(MSG * pMsg) 
+{
+	bool ret = false;
 	DWORD dID;
+
 	if (m_actions.OnMsg(pMsg, dID))
 	{
-		bool ret = DoAction(dID);
-
-		if (ret)
-		{
-			return TRUE;
-		}
-	}    
+		ret = DoAction(dID);
+	}   
 
-    return CWndEx::PreTranslateMessage(pMsg);
+	return ret;
 }
 
 bool CQPasteWnd::DoAction(DWORD actionId)
@@ -3790,7 +3797,12 @@ LRESULT CQPasteWnd::OnUpDown(WPARAM wParam, LPARAM lParam)
 
     if(m_lstHeader.HandleKeyDown(wParam, lParam) == FALSE)
     {
-        m_lstHeader.SendMessage(WM_KEYDOWN, wParam, lParam);
+		MSG msg;
+		msg.lParam = lParam;
+		msg.wParam = wParam;
+		msg.message = WM_KEYDOWN;
+
+		CheckActions(&msg);
     }
 
     return TRUE;

+ 4 - 1
QPasteWnd.h

@@ -112,7 +112,10 @@ public:
 public:
     virtual BOOL Create(const POINT &ptStart, CWnd *pParentWnd);
     virtual BOOL PreTranslateMessage(MSG *pMsg);
-    //}}AFX_VIRTUAL
+
+	bool CheckActions(MSG * pMsg);
+
+	//}}AFX_VIRTUAL
 
     // Implementation
 public:

+ 35 - 8
ToolTipEx.cpp

@@ -52,6 +52,8 @@ ON_COMMAND(ID_FIRST_REMEMBERWINDOWPOSITION, &CToolTipEx::OnRememberwindowpositio
 ON_COMMAND(ID_FIRST_SIZEWINDOWTOCONTENT, &CToolTipEx::OnSizewindowtocontent)
 ON_COMMAND(ID_FIRST_SCALEIMAGESTOFITWINDOW, &CToolTipEx::OnScaleimagestofitwindow)
 ON_COMMAND(2, OnOptions)
+ON_WM_RBUTTONDOWN()
+ON_WM_SETFOCUS()
 END_MESSAGE_MAP() 
 
 
@@ -66,13 +68,10 @@ BOOL CToolTipEx::Create(CWnd *pParentWnd)
 
     // Create the window - just don't show it yet.
     if( !CWnd::CreateEx(WS_EX_TOPMOST, szClassName, _T(""), WS_POPUP | WS_BORDER,
-       0, 0, 10, 10,  // size & position updated when needed
-    pParentWnd->GetSafeHwnd(), 0, NULL))
+       0, 0, 0, 0, pParentWnd->GetSafeHwnd(), 0, NULL))
     {
         return FALSE;
-    }
-
-	
+    }	
 
 	m_DittoWindow.DoCreate(this);
 	m_DittoWindow.SetCaptionColors(g_Opt.m_Theme.CaptionLeft(), g_Opt.m_Theme.CaptionRight());
@@ -109,6 +108,7 @@ BOOL CToolTipEx::Show(CPoint point)
     else
     {
         m_RichEdit.ShowWindow(SW_SHOW);
+		//m_RichEdit.SetFocus();
     }
 
 	CRect rect;
@@ -319,6 +319,16 @@ BOOL CToolTipEx::PreTranslateMessage(MSG *pMsg)
                 }
                 break;
             }
+			break;
+		case WM_RBUTTONDOWN:
+			{
+				if (m_RichEdit.m_hWnd == GetFocus()->m_hWnd)
+				{
+					OnOptions();
+					return TRUE;
+				}
+			}
+			break;
     }
 
     return CWnd::PreTranslateMessage(pMsg);
@@ -368,8 +378,8 @@ BOOL CToolTipEx::OnMsg(MSG *pMsg)
 
                 break;
             }
+
         case WM_LBUTTONDBLCLK:
-        case WM_RBUTTONDOWN:
         case WM_RBUTTONDBLCLK:
         case WM_MBUTTONDOWN:
         case WM_MBUTTONDBLCLK:
@@ -545,7 +555,7 @@ void CToolTipEx::OnSize(UINT nType, int cx, int cy)
         return ;
     }
 
-	m_DittoWindow.DoSetRegion(this);
+	
 
     CRect cr;
     GetClientRect(cr);
@@ -555,6 +565,8 @@ void CToolTipEx::OnSize(UINT nType, int cx, int cy)
 	m_optionsButton.MoveWindow(cr.left, cr.bottom + theApp.m_metrics.ScaleY(2), theApp.m_metrics.ScaleX(17), theApp.m_metrics.ScaleY(17));
 
 	this->Invalidate();
+
+	m_DittoWindow.DoSetRegion(this);
 }
 
 BOOL CToolTipEx::IsCursorInToolTip()
@@ -716,4 +728,19 @@ void CToolTipEx::OnScaleimagestofitwindow()
 {
 	CGetSetOptions::SetScaleImagesToDescWindow(!CGetSetOptions::GetScaleImagesToDescWindow());
 	Invalidate();
-}
+}
+
+void CToolTipEx::OnRButtonDown(UINT nFlags, CPoint point)
+{
+	OnOptions();
+
+	CWnd::OnRButtonDown(nFlags, point);
+}
+
+
+void CToolTipEx::OnSetFocus(CWnd* pOldWnd)
+{
+	CWnd::OnSetFocus(pOldWnd);
+
+	m_RichEdit.SetFocus();
+}

+ 2 - 0
ToolTipEx.h

@@ -90,6 +90,8 @@ public:
 	afx_msg void OnRememberwindowposition();
 	afx_msg void OnSizewindowtocontent();
 	afx_msg void OnScaleimagestofitwindow();
+	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnSetFocus(CWnd* pOldWnd);
 };
 
 /////////////////////////////////////////////////////////////////////////////