From 5c30cf0b32f84ac431b93e8494b2396d1d53a158 Mon Sep 17 00:00:00 2001 From: Sup Yut Sum Date: Thu, 24 Oct 2013 09:04:53 +0800 Subject: [PATCH] Add routine to set CHistoryCombo case sensitive or not Signed-off-by: Sup Yut Sum --- src/Utils/MiscUI/HistoryCombo.cpp | 3 ++- src/Utils/MiscUI/HistoryCombo.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Utils/MiscUI/HistoryCombo.cpp b/src/Utils/MiscUI/HistoryCombo.cpp index faeb30627..15fd68088 100644 --- a/src/Utils/MiscUI/HistoryCombo.cpp +++ b/src/Utils/MiscUI/HistoryCombo.cpp @@ -37,6 +37,7 @@ CHistoryCombo::CHistoryCombo(BOOL bAllowSortStyle /*=FALSE*/ ) m_bDyn = FALSE; m_bWantReturn = FALSE; m_bTrim = TRUE; + m_bCaseSensitive = FALSE; SecureZeroMemory(&m_ToolInfo, sizeof(m_ToolInfo)); } @@ -119,7 +120,7 @@ int CHistoryCombo::AddString(CString str, INT_PTR pos,BOOL isSel) //search the Combo for another string like this //and do not insert if found - int nIndex = FindStringExactCaseSensitive(-1, combostring); + int nIndex = m_bCaseSensitive ? FindStringExactCaseSensitive(-1, combostring) : FindStringExact(-1, combostring); if (nIndex != -1) { if (nIndex > pos) diff --git a/src/Utils/MiscUI/HistoryCombo.h b/src/Utils/MiscUI/HistoryCombo.h index abb63dc8d..739568638 100644 --- a/src/Utils/MiscUI/HistoryCombo.h +++ b/src/Utils/MiscUI/HistoryCombo.h @@ -131,6 +131,8 @@ public: */ void DisableTrimming() { m_bTrim = false; } + void SetCaseSensitive(BOOL bCaseSensitive) { m_bCaseSensitive = bCaseSensitive; } + int FindStringExactCaseSensitive(int nIndexStart, LPCTSTR lpszFind); protected: @@ -157,4 +159,5 @@ protected: BOOL m_ttShown; BOOL m_bDyn; BOOL m_bTrim; + BOOL m_bCaseSensitive; }; -- 2.11.4.GIT