Bläddra i källkod

Handle repeated keys on up/down and next/prev description

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@816 595ec19a-5cb4-439b-94a8-42fb3063c22c
sabrogden 10 år sedan
förälder
incheckning
0a97fc1fb1
3 ändrade filer med 25 tillägg och 9 borttagningar
  1. 17 9
      Accels.cpp
  2. 2 0
      Accels.h
  3. 6 0
      QPasteWnd.cpp

+ 17 - 9
Accels.cpp

@@ -2,8 +2,9 @@
 #include "Accels.h"
 #include "HotKeys.h"
 
-CAccels::CAccels(){
-
+CAccels::CAccels()
+{
+	m_handleRepeatKeys = false;
 }
 
 void CAccels::AddAccel(CAccel a)
@@ -45,13 +46,20 @@ CString CAccels::GetCmdKeyText(DWORD cmd)
 }
 
 bool CAccels::OnMsg(MSG *pMsg, CAccel &a)
-{
-    // bit 30 (0x40000000) is 1 if this is NOT the first msg of the key
-    //  i.e. auto-repeat may cause multiple msgs of the same key
-    if((pMsg->lParam &0x40000000) || (pMsg->message != WM_KEYDOWN && pMsg->message != WM_SYSKEYDOWN))
-    {
-        return NULL;
-    }
+{    
+	if((pMsg->message != WM_KEYDOWN && pMsg->message != WM_SYSKEYDOWN))
+	{
+		return NULL;
+	}
+
+	// bit 30 (0x40000000) is 1 if this is NOT the first msg of the key
+	//  i.e. auto-repeat may cause multiple msgs of the same key
+	if((pMsg->lParam &0x40000000) && m_handleRepeatKeys == false)
+	{
+		return NULL;
+	}
+
+	m_handleRepeatKeys = false;
 
     if(!pMsg || m_Map.GetCount() <= 0)
     {

+ 2 - 0
Accels.h

@@ -39,6 +39,8 @@ public:
     // returns a pointer to the internal CAccel if it matches the given key or NULL
     bool OnMsg(MSG *pMsg, CAccel &a);
 
+	bool m_handleRepeatKeys;
+
     static BYTE GetKeyStateModifiers();
 
 protected:

+ 6 - 0
QPasteWnd.cpp

@@ -2703,6 +2703,8 @@ bool CQPasteWnd::DoActionNextDescription()
 	if (g_Opt.m_bAllwaysShowDescription)
 		return false;
 
+	m_actions.m_handleRepeatKeys = true;
+
 	ARRAY Indexes;
 	m_lstHeader.GetSelectionIndexes(Indexes);
 
@@ -2748,6 +2750,8 @@ bool CQPasteWnd::DoActionPrevDescription()
 	if (g_Opt.m_bAllwaysShowDescription)
 		return false;
 
+	m_actions.m_handleRepeatKeys = true;
+
 	ARRAY Indexes;
 	m_lstHeader.GetSelectionIndexes(Indexes);
 
@@ -2951,6 +2955,7 @@ bool CQPasteWnd::DoActionSelectionUp()
 	if (m_bModifersMoveActive)
 	{
 		MoveSelection(false);
+		m_actions.m_handleRepeatKeys = true;
 		return true;
 	}
 
@@ -2962,6 +2967,7 @@ bool CQPasteWnd::DoActionSelectionDown()
 	if (m_bModifersMoveActive)
 	{
 		MoveSelection(true);
+		m_actions.m_handleRepeatKeys = true;
 		return true;
 	}