Browse Source

F3 searches list by default on second press if searching

sabrogden 8 years ago
parent
commit
9da6799901
8 changed files with 88 additions and 19 deletions
  1. 2 1
      ActionEnums.cpp
  2. 4 4
      OleClipSource.cpp
  3. 31 3
      QListCtrl.cpp
  4. 2 0
      QListCtrl.h
  5. 46 3
      QPasteWnd.cpp
  6. 0 1
      SymbolEdit.cpp
  7. 0 5
      ToolTipEx.cpp
  8. 3 2
      ToolTipEx.h

+ 2 - 1
ActionEnums.cpp

@@ -369,7 +369,7 @@ int ActionEnums::GetDefaultShortCutKeyA(ActionEnumValues value, int pos)
 		break;
 	case 1:
 		switch (value)
-		{
+		{		
 		case ActionEnums::PASTE_SELECTED:
 			return VK_MOUSE_DOUBLE_CLICK;
 		case PASTE_POSITION_1:
@@ -443,6 +443,7 @@ bool ActionEnums::ToolTipAction(ActionEnumValues value)
 	case ActionEnums::TOGGLESHOWPERSISTANT:
 	case ActionEnums::TOGGLE_DESCRIPTION_WORD_WRAP:
 	case ActionEnums::CLOSEWINDOW:
+	case ActionEnums::SHOWDESCRIPTION:
 
 		return true;
 	}

+ 4 - 4
OleClipSource.cpp

@@ -203,18 +203,18 @@ BOOL COleClipSource::DoImmediateRender()
 	{
 		try
 		{
-			Log(StrF(_T("Start of process copy name: %s, script: %s"), g_Opt.m_pasteScripts.m_list[m_pasteOptions.m_pasteScriptIndex].m_name, g_Opt.m_pasteScripts.m_list[m_pasteOptions.m_pasteScriptIndex].m_script));
+			Log(StrF(_T("Start of paste script name: %s, script: %s"), g_Opt.m_pasteScripts.m_list[m_pasteOptions.m_pasteScriptIndex].m_name, g_Opt.m_pasteScripts.m_list[m_pasteOptions.m_pasteScriptIndex].m_script));
 
 			ChaiScriptOnCopy onPaste;
 			CDittoChaiScript clipData(&clip, "");
 			if (onPaste.ProcessScript(clipData, (LPCSTR)CTextConvert::ConvertToChar(g_Opt.m_pasteScripts.m_list[m_pasteOptions.m_pasteScriptIndex].m_script)) == false)
 			{
-				Log(StrF(_T("End of process copy name: %s, returned false, not saving this copy to Ditto, last Error: %s"), g_Opt.m_pasteScripts.m_list[m_pasteOptions.m_pasteScriptIndex].m_name, onPaste.m_lastError));
+				Log(StrF(_T("End of paste script name: %s, returned false, not saving this copy to Ditto, last Error: %s"), g_Opt.m_pasteScripts.m_list[m_pasteOptions.m_pasteScriptIndex].m_name, onPaste.m_lastError));
 
-				return -1;
+				return FALSE;
 			}
 
-			Log(StrF(_T("End of process copy name: %s, returned true, last Error: %s"), g_Opt.m_pasteScripts.m_list[m_pasteOptions.m_pasteScriptIndex].m_name, onPaste.m_lastError));			
+			Log(StrF(_T("End of paste script name: %s, returned true, last Error: %s"), g_Opt.m_pasteScripts.m_list[m_pasteOptions.m_pasteScriptIndex].m_name, onPaste.m_lastError));			
 		}
 		catch (CException *ex)
 		{

+ 31 - 3
QListCtrl.cpp

@@ -1542,6 +1542,8 @@ void CQListCtrl::OnMouseMove(UINT nFlags, CPoint point)
 			KillTimer(TIMER_SHOW_SCROLL);
 		}
 	}
+
+	CListCtrl::OnMouseMove(nFlags, point);
 }
 
 bool CQListCtrl::MouseInScrollBarArea(CRect crWindow, CPoint point)
@@ -1591,7 +1593,12 @@ void CQListCtrl::HidePopup(bool checkShowPersistant)
 
 BOOL CQListCtrl::IsToolTipWindowVisible() 
 { 
-	return ::IsWindowVisible(m_toolTipHwnd); 
+	if (VALID_TOOLTIP)
+	{
+		return ::IsWindowVisible(m_toolTipHwnd);
+	}
+
+	return FALSE;
 }
 
 void CQListCtrl::ToggleToolTipShowPersistant()
@@ -1616,8 +1623,13 @@ bool CQListCtrl::ToggleToolTipWordWrap()
 
 BOOL CQListCtrl::IsToolTipWindowFocus()
 {
-	return ::GetFocus() == m_toolTipHwnd ||
-		::GetParent(::GetFocus()) == m_toolTipHwnd;
+	if (VALID_TOOLTIP)
+	{
+		return ::GetFocus() == m_toolTipHwnd ||
+			::GetParent(::GetFocus()) == m_toolTipHwnd;
+	}
+
+	return FALSE;
 }
 
 bool CQListCtrl::IsToolTipShowPersistant()
@@ -1628,4 +1640,20 @@ bool CQListCtrl::IsToolTipShowPersistant()
 	}
 
 	return false;
+}
+
+void CQListCtrl::DoToolTipSearch()
+{
+	if (VALID_TOOLTIP)
+	{
+		return m_pToolTip->DoSearch();
+	}
+}
+
+void CQListCtrl::HideToolTip()
+{
+	if (VALID_TOOLTIP)
+	{
+		m_pToolTip->Hide();
+	}
 }

+ 2 - 0
QListCtrl.h

@@ -140,6 +140,8 @@ public:
 	bool ToggleToolTipWordWrap();
 	void SetTooltipActions(CAccels *pToolTipActions) { m_pToolTipActions = pToolTipActions; }
 	bool IsToolTipShowPersistant();
+	void DoToolTipSearch();
+	void HideToolTip();
 
 	void SetLogFont(LOGFONT &font);
 

+ 46 - 3
QPasteWnd.cpp

@@ -325,8 +325,7 @@ int CQPasteWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
         return -1;
     }
 
-	//m_pDropTarget = new CMyDropTarget(this);
-	//m_pDropTarget->Register(this);
+	//BOOL b = this->Register(this);
 
     SetWindowText(_T(QPASTE_TITLE));
 
@@ -490,9 +489,32 @@ void CQPasteWnd::LoadShortcuts()
 					int b = g_Opt.GetActionShortCutB(action, i);
 					m_actions.AddAccel(action, a, b);
 
+					//always add a shift variation to show description F3 so it will search backwards in the text search
+					if (action == ActionEnums::SHOWDESCRIPTION)
+					{
+						int shift = HOTKEYF_SHIFT;
+						if ((HIBYTE(a) & HOTKEYF_SHIFT))
+						{
+							shift = 0;
+						}
+
+						m_actions.AddAccel(action, ACCEL_MAKEKEY(LOBYTE(a), shift), b);
+					}
+
 					if (ActionEnums::ToolTipAction(action))
 					{
 						m_toolTipActions.AddAccel(action, a, b);
+
+						if (action == ActionEnums::SHOWDESCRIPTION)
+						{
+							int shift = HOTKEYF_SHIFT;
+							if ((HIBYTE(a) & HOTKEYF_SHIFT))
+							{
+								shift = 0;
+							}
+
+							m_toolTipActions.AddAccel(action, ACCEL_MAKEKEY(LOBYTE(a), shift), b);
+						}
 					}
 				}
 			}
@@ -3113,7 +3135,28 @@ bool CQPasteWnd::DoActionToggleDescriptionWordWrap()
 
 bool CQPasteWnd::DoActionShowDescription()
 {
-	bool ret = m_lstHeader.ShowFullDescription(false, false);
+	bool ret = false;
+
+	if (m_lstHeader.IsToolTipWindowVisible() == false)
+	{
+		ret = m_lstHeader.ShowFullDescription(false, false);
+	}
+	else
+	{
+		CString csText;
+		m_search.GetWindowText(csText);
+		if (csText != _T(""))
+		{
+			m_lstHeader.DoToolTipSearch();
+			ret = true;
+		}
+		else
+		{
+			m_lstHeader.HideToolTip();
+			ret = true;
+		}
+	}
+
 	return (ret == true);
 }
 

+ 0 - 1
SymbolEdit.cpp

@@ -128,7 +128,6 @@ BOOL CSymbolEdit::PreTranslateMessage(MSG* pMsg)
 		}
 		else if (pMsg->wParam == VK_DOWN ||
 			pMsg->wParam == VK_UP ||
-			pMsg->wParam == VK_F3 ||
 			pMsg->wParam == VK_PRIOR ||
 			pMsg->wParam == VK_NEXT)
 		{

+ 0 - 5
ToolTipEx.cpp

@@ -337,11 +337,6 @@ BOOL CToolTipEx::PreTranslateMessage(MSG *pMsg)
                     m_RichEdit.Copy();
                 }
                 break;
-			case VK_F3:
-			{
-				DoSearch();
-			}
-			break;
             }
 			break;
 		case WM_RBUTTONDOWN:

+ 3 - 2
ToolTipEx.h

@@ -49,6 +49,8 @@ public:
 
 	void UpdateMenuShortCut(CMenu *subMenu, int id, DWORD action);
 
+	void DoSearch();
+
 // Overrides
 	// ClassWizard generated virtual function overrides
 	//{{AFX_VIRTUAL(CToolTipEx)
@@ -92,8 +94,7 @@ protected:
 	BOOL SetLogFont(LPLOGFONT lpLogFont, BOOL bRedraw /*=TRUE*/);
 	LPLOGFONT GetSystemToolTipFont();
 	BOOL IsCursorInToolTip();
-	void HighlightSearchText();
-	void DoSearch();
+	void HighlightSearchText();	
 	void ApplyWordWrap();
 	void SaveWindowSize();