Browse Source

changed double keystroke timeout to be 350, added adv option to set this

scott brogden 6 years ago
parent
commit
d517b85780
5 changed files with 33 additions and 5 deletions
  1. 5 4
      Accels.cpp
  2. 10 0
      AdvGeneral.cpp
  3. 13 0
      Options.cpp
  4. 4 0
      Options.h
  5. 1 1
      QPasteWnd.cpp

+ 5 - 4
Accels.cpp

@@ -1,6 +1,7 @@
 #include "stdafx.h"
 #include "stdafx.h"
 #include "Accels.h"
 #include "Accels.h"
 #include "HotKeys.h"
 #include "HotKeys.h"
+#include "Options.h"
 
 
 CAccels::CAccels()
 CAccels::CAccels()
 {
 {
@@ -90,12 +91,12 @@ bool CAccels::OnMsg(MSG *pMsg, CAccel &a)
 	}
 	}
     DWORD key = ACCEL_MAKEKEY(vkey, mod);
     DWORD key = ACCEL_MAKEKEY(vkey, mod);
 
 
-    CString cs;
-    cs.Format(_T("Key: %d, Mod: %d, vkey: %d\r\n"), key, mod, vkey);
-    OutputDebugString(cs);
+    //CString cs;
+    //cs.Format(_T("Key: %d, Mod: %d, vkey: %d, diff: %d\r\n"), key, mod, vkey, (GetTickCount() - m_firstMapTick));
+    //OutputDebugString(cs);
 		
 		
 	if (m_firstMapTick != 0 &&
 	if (m_firstMapTick != 0 &&
-		(GetTickCount() - m_firstMapTick) < 500)
+		(GetTickCount() - m_firstMapTick) < CGetSetOptions::m_doubleKeyStrokeTimeout)
 	{
 	{
 		pair<multimap<DWORD, CAccel>::iterator, multimap<DWORD, CAccel>::iterator> ppp;
 		pair<multimap<DWORD, CAccel>::iterator, multimap<DWORD, CAccel>::iterator> ppp;
 		ppp = m_multiMap.equal_range(m_activeFirstKey);
 		ppp = m_multiMap.equal_range(m_activeFirstKey);

+ 10 - 0
AdvGeneral.cpp

@@ -118,6 +118,7 @@ END_MESSAGE_MAP()
 #define SETTING_TOOLTIP_CHARACTERS 70
 #define SETTING_TOOLTIP_CHARACTERS 70
 
 
 #define SETTING_ACTIVATE_WINDOW_DELAY 71
 #define SETTING_ACTIVATE_WINDOW_DELAY 71
+#define SETTING_DOUBLE_KEYSTROKE_TIMEOUT 72
 
 
 BOOL CAdvGeneral::OnInitDialog()
 BOOL CAdvGeneral::OnInitDialog()
 {
 {
@@ -161,6 +162,9 @@ BOOL CAdvGeneral::OnInitDialog()
 
 
 
 
 	AddTrueFalse(pGroupTest, _T("Display Icon in System Tray"), CGetSetOptions::GetShowIconInSysTray(), SETTING_SHOW_TASKBAR_ICON);
 	AddTrueFalse(pGroupTest, _T("Display Icon in System Tray"), CGetSetOptions::GetShowIconInSysTray(), SETTING_SHOW_TASKBAR_ICON);
+
+	pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Double shortcut keystroke timeout)"), (long)CGetSetOptions::GetDoubleKeyStrokeTimeout(), _T(""), SETTING_DOUBLE_KEYSTROKE_TIMEOUT));
+
 	AddTrueFalse(pGroupTest, _T("Draw RTF Text in List(for RTF types) (Could Increase Memory Usage an Display Speed)"), CGetSetOptions::GetDrawRTF(), SETTING_DRAW_RTF);
 	AddTrueFalse(pGroupTest, _T("Draw RTF Text in List(for RTF types) (Could Increase Memory Usage an Display Speed)"), CGetSetOptions::GetDrawRTF(), SETTING_DRAW_RTF);
 	AddTrueFalse(pGroupTest, _T("Elevated privileges to paste into elevated apps"), CGetSetOptions::GetPasteAsAdmin(), SETTING_PASTE_AS_ADMIN);
 	AddTrueFalse(pGroupTest, _T("Elevated privileges to paste into elevated apps"), CGetSetOptions::GetPasteAsAdmin(), SETTING_PASTE_AS_ADMIN);
 	AddTrueFalse(pGroupTest, _T("Ensure Ditto is always connected to the clipboard"), CGetSetOptions::GetEnsureConnectToClipboard(), SETTING_ENSURE_CONNECTED);
 	AddTrueFalse(pGroupTest, _T("Ensure Ditto is always connected to the clipboard"), CGetSetOptions::GetEnsureConnectToClipboard(), SETTING_ENSURE_CONNECTED);
@@ -712,6 +716,12 @@ void CAdvGeneral::OnBnClickedOk()
 					CGetSetOptions::SetSendKeysDelay(pNewValue->lVal);
 					CGetSetOptions::SetSendKeysDelay(pNewValue->lVal);
 				}
 				}
 				break;
 				break;
+			case SETTING_DOUBLE_KEYSTROKE_TIMEOUT:
+				if (pNewValue->lVal != pOrigValue->lVal)
+				{
+					CGetSetOptions::SetDoubleKeyStrokeTimeout(pNewValue->lVal);
+				}
+				break;
 			}
 			}
 		}
 		}
 	}
 	}

+ 13 - 0
Options.cpp

@@ -73,6 +73,7 @@ CChaiScriptXml CGetSetOptions::m_copyScripts;
 CChaiScriptXml CGetSetOptions::m_pasteScripts;
 CChaiScriptXml CGetSetOptions::m_pasteScripts;
 long CGetSetOptions::m_tooltipTimeout;
 long CGetSetOptions::m_tooltipTimeout;
 BOOL CGetSetOptions::m_cleanRTFBeforeDrawing = TRUE;
 BOOL CGetSetOptions::m_cleanRTFBeforeDrawing = TRUE;
+int CGetSetOptions::m_doubleKeyStrokeTimeout = 350;
 
 
 CGetSetOptions::CGetSetOptions()
 CGetSetOptions::CGetSetOptions()
 {
 {
@@ -192,6 +193,7 @@ void CGetSetOptions::LoadSettings()
 	m_showScrollBar = GetShowScrollBar();
 	m_showScrollBar = GetShowScrollBar();
 	m_bShowAlwaysOnTopWarning = GetShowAlwaysOnTopWarning();
 	m_bShowAlwaysOnTopWarning = GetShowAlwaysOnTopWarning();
 	m_excludeCF_DIBInExcel = GetExcludeCF_DIBInExcel();
 	m_excludeCF_DIBInExcel = GetExcludeCF_DIBInExcel();
+	m_doubleKeyStrokeTimeout = GetDoubleKeyStrokeTimeout();
 
 
 	GetExtraNetworkPassword(true);
 	GetExtraNetworkPassword(true);
 
 
@@ -2776,4 +2778,15 @@ int CGetSetOptions::GetMaxToolTipCharacters()
 void CGetSetOptions::SetMaxToolTipCharacters(int val)
 void CGetSetOptions::SetMaxToolTipCharacters(int val)
 {
 {
 	SetProfileLong("MaxToolTipCharacters", val);
 	SetProfileLong("MaxToolTipCharacters", val);
+}
+
+int CGetSetOptions::GetDoubleKeyStrokeTimeout()
+{
+	return GetProfileLong("DoubleKeyStrokeTimeout", 350);
+}
+
+void CGetSetOptions::SetDoubleKeyStrokeTimeout(int val)
+{
+	m_doubleKeyStrokeTimeout = val;
+	SetProfileLong("DoubleKeyStrokeTimeout", val);
 }
 }

+ 4 - 0
Options.h

@@ -618,6 +618,10 @@ public:
 
 
 	static int GetMaxToolTipCharacters();
 	static int GetMaxToolTipCharacters();
 	static void SetMaxToolTipCharacters(int val);
 	static void SetMaxToolTipCharacters(int val);
+
+	static int m_doubleKeyStrokeTimeout;
+	static int GetDoubleKeyStrokeTimeout();
+	static void SetDoubleKeyStrokeTimeout(int val);
 };
 };
 
 
 // global for easy access and for initialization of fast access variables
 // global for easy access and for initialization of fast access variables

+ 1 - 1
QPasteWnd.cpp

@@ -2852,7 +2852,7 @@ bool CQPasteWnd::CheckActions(MSG * pMsg)
 		else if (a.Cmd > 0)
 		else if (a.Cmd > 0)
 		{
 		{
 			m_timerAction = a;
 			m_timerAction = a;
-			SetTimer(TIMER_DO_ACTION, 500, NULL);
+			SetTimer(TIMER_DO_ACTION, CGetSetOptions::m_doubleKeyStrokeTimeout, NULL);
 		}
 		}
 	}
 	}