Browse Source

Fixed issue with escape key not working the first time

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@706 595ec19a-5cb4-439b-94a8-42fb3063c22c
sabrogden 11 years ago
parent
commit
30e9e1d726
4 changed files with 20 additions and 7 deletions
  1. 13 5
      MainFrm.cpp
  2. 4 1
      MainFrm.h
  3. 1 1
      QPasteWnd.cpp
  4. 2 0
      QuickPaste.cpp

+ 13 - 5
MainFrm.cpp

@@ -238,11 +238,7 @@ LRESULT CMainFrame::OnHotKey(WPARAM wParam, LPARAM lParam)
         {
             Log(_T("On Show Ditto HotKey, showing window"));
 
-            m_keyModifiersTimerCount = 0;
-            m_bMovedSelectionMoveKeyState = false;
-            m_startKeyStateTime = GetTickCount();
-            m_keyStateModifiers = CAccels::GetKeyStateModifiers();
-            SetTimer(KEY_STATE_MODIFIERS, 50, NULL);
+			StartKeyModifyerTimer();
 
 			//Before we show our window find the current focused window for paste into
 			theApp.m_activeWnd.TrackActiveWnd(true);
@@ -419,6 +415,15 @@ void CMainFrame::DoFirstTenPositionsPaste(int nPos)
     CATCH_SQLITE_EXCEPTION
 }
 
+void CMainFrame::StartKeyModifyerTimer()
+{
+	m_keyModifiersTimerCount = 0;
+	m_bMovedSelectionMoveKeyState = false;
+	m_startKeyStateTime = GetTickCount();
+	m_keyStateModifiers = CAccels::GetKeyStateModifiers();
+	SetTimer(KEY_STATE_MODIFIERS, 50, NULL);
+}
+
 void CMainFrame::PasteOrShowGroup(int dbId, BOOL updateClipTime, BOOL activeTarget, BOOL sendPaste)
 {
 	try
@@ -426,6 +431,9 @@ void CMainFrame::PasteOrShowGroup(int dbId, BOOL updateClipTime, BOOL activeTarg
 		if (theApp.EnterGroupID(dbId, FALSE, TRUE))
 		{			
 			theApp.m_activeWnd.TrackActiveWnd(true);
+			
+			StartKeyModifyerTimer();
+
 			m_quickPaste.ShowQPasteWnd(this, false, true, FALSE);
 		}
 		else

+ 4 - 1
MainFrm.h

@@ -67,7 +67,10 @@ public:
     void DoDittoCopyBufferPaste(int nCopyBuffer);
     void DoFirstTenPositionsPaste(int nPos);
 	void PasteOrShowGroup(int dbId, BOOL updateClipTime, BOOL activeTarget, BOOL sendPaste);
-    bool PasteQuickPasteEntry(CString csQuickPaste);
+
+	void StartKeyModifyerTimer();
+
+	bool PasteQuickPasteEntry(CString csQuickPaste);
     bool SaveQuickPasteEntry(CString csQuickPaste, CClipList *pClipList);
     void ShowErrorMessage(CString csTitle, CString csMessage);
     bool CloseAllOpenDialogs();

+ 1 - 1
QPasteWnd.cpp

@@ -627,7 +627,7 @@ BOOL CQPasteWnd::ShowQPasteWindow(BOOL bFillList)
 		::SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
 	}
 
-    SetKeyModiferState(true);
+    //SetKeyModiferState(true);
 
 	Log(StrF(_T("END - ShowQPasteWindow - Fill List: %d, array count: %d"), bFillList, m_listItems.size()));
 

+ 2 - 0
QuickPaste.cpp

@@ -190,6 +190,8 @@ void CQuickPaste::ShowQPasteWnd(CWnd *pParent, bool bAtPrevPos, bool bFromKeyboa
 	{
 		m_pwndPaste->MoveWindow(crRect);
 	}
+
+	m_pwndPaste->SetKeyModiferState(bFromKeyboard);
 	
 	// Show the window
 	m_pwndPaste->ShowWindow(SW_SHOW);