1
0
Эх сурвалжийг харах

Don't remove search data when diffing clips or when opening google translate

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@761 595ec19a-5cb4-439b-94a8-42fb3063c22c
sabrogden 10 жил өмнө
parent
commit
f52aa6d0a4
2 өөрчлөгдсөн 50 нэмэгдсэн , 21 устгасан
  1. 49 20
      QPasteWnd.cpp
  2. 1 1
      QPasteWnd.h

+ 49 - 20
QPasteWnd.cpp

@@ -522,7 +522,7 @@ void CQPasteWnd::OnActivate(UINT nState, CWnd *pWndOther, BOOL bMinimized)
     }
 }
 
-BOOL CQPasteWnd::HideQPasteWindow(bool releaseFocus)
+BOOL CQPasteWnd::HideQPasteWindow (bool releaseFocus, bool clearSearchData)
 {
     Log(_T("Start of HideQPasteWindow"));
 	DWORD startTick = GetTickCount();
@@ -562,30 +562,32 @@ BOOL CQPasteWnd::HideQPasteWindow(bool releaseFocus)
 		ShowWindow(SW_HIDE);
 	}
 	
+	if(clearSearchData)
+	{
+		//Reset the selection in the search combo
+		m_bHandleSearchTextChange = false;
+		m_search.SetWindowText(_T(""));
+		m_bHandleSearchTextChange = true;
 
-    //Reset the selection in the search combo
-    m_bHandleSearchTextChange = false;
-    m_search.SetWindowText(_T(""));
-    m_bHandleSearchTextChange = true;
-
-    if(m_strSQLSearch.IsEmpty() == FALSE)
-    {
-        {
-			ATL::CCritSecLock csLock(m_CritSection.m_sect);
+		if(m_strSQLSearch.IsEmpty() == FALSE)
+		{
+			{
+				ATL::CCritSecLock csLock(m_CritSection.m_sect);
           
-			m_bStopQuery = true;
-        }
+				m_bStopQuery = true;
+			}
 
-        //Wait for the thread to stop fill the cache so we can clear it
-        WaitForSingleObject(m_thread.m_SearchingEvent, 5000);
+			//Wait for the thread to stop fill the cache so we can clear it
+			WaitForSingleObject(m_thread.m_SearchingEvent, 5000);
 
-        {
-			ATL::CCritSecLock csLock(m_CritSection.m_sect);
+			{
+				ATL::CCritSecLock csLock(m_CritSection.m_sect);
             
-			m_listItems.clear();
-            m_lstHeader.SetItemCountEx(0);
-        }
-    }
+				m_listItems.clear();
+				m_lstHeader.SetItemCountEx(0);
+			}
+		}
+	}
 
 	theApp.TryEnterOldGroupState();
 
@@ -3287,6 +3289,15 @@ bool CQPasteWnd::DoClipCompare()
 
 		if(IDs.GetCount() > 1)
 		{
+			if(!g_Opt.m_bShowPersistent)
+			{
+				HideQPasteWindow(false, false);
+			}
+			else if(g_Opt.GetAutoHide())
+			{
+				MinMaxWindow(FORCE_MIN);
+			}
+
 			CClipCompare compare;
 			compare.Compare(IDs[0], IDs[1]);
 			
@@ -3336,6 +3347,15 @@ bool CQPasteWnd::DoSelectRightSideAndDoCompare()
 			{
 				int rightId = IDs[0];
 
+				if(!g_Opt.m_bShowPersistent)
+				{
+					HideQPasteWindow(false, false);
+				}
+				else if(g_Opt.GetAutoHide())
+				{
+					MinMaxWindow(FORCE_MIN);
+				}
+
 				CClipCompare compare;
 				compare.Compare(m_leftSelectedCompareId, rightId);
 
@@ -3526,6 +3546,15 @@ bool CQPasteWnd::DoExportToGoogleTranslate()
 					CString url;
 					url.Format(CGetSetOptions::GetTranslateUrl(), clipTextUrlEncoded);
 
+					if(!g_Opt.m_bShowPersistent)
+					{
+						HideQPasteWindow(false, false);
+					}
+					else if(g_Opt.GetAutoHide())
+					{
+						MinMaxWindow(FORCE_MIN);
+					}
+
 					CHyperLink::GotoURL(url, SW_SHOW);
 
 					ret = true;

+ 1 - 1
QPasteWnd.h

@@ -165,7 +165,7 @@ public:
     void RefreshNc();
     void UpdateStatus(bool bRepaintImmediately = false); // regenerates the status (caption) text
     BOOL FillList(CString csSQLSearch = "");
-    BOOL HideQPasteWindow(bool releaseFocus);
+    BOOL HideQPasteWindow(bool releaseFocus, bool clearSearchData = true);
     BOOL ShowQPasteWindow(BOOL bFillList = TRUE);
     void MoveControls();