From 44c1642a2c2b95180dedcd6d68dc5bb367875d04 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sun, 30 Dec 2012 17:32:08 +0100 Subject: [PATCH] Added support from disable trimming Based on TortoiseSVN revision 22145. Signed-off-by: Sven Strickroth --- src/Utils/MiscUI/HistoryCombo.cpp | 10 +++++++--- src/Utils/MiscUI/HistoryCombo.h | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Utils/MiscUI/HistoryCombo.cpp b/src/Utils/MiscUI/HistoryCombo.cpp index efb55fff0..45d62cad0 100644 --- a/src/Utils/MiscUI/HistoryCombo.cpp +++ b/src/Utils/MiscUI/HistoryCombo.cpp @@ -36,6 +36,7 @@ CHistoryCombo::CHistoryCombo(BOOL bAllowSortStyle /*=FALSE*/ ) m_ttShown = FALSE; m_bDyn = FALSE; m_bWantReturn = FALSE; + m_bTrim = TRUE; SecureZeroMemory(&m_ToolInfo, sizeof(m_ToolInfo)); } @@ -112,11 +113,13 @@ int CHistoryCombo::AddString(CString str, INT_PTR pos,BOOL isSel) else cbei.iItem = pos; - str.Trim(_T(" ")); + if (m_bTrim) + str.Trim(_T(" ")); CString combostring = str; combostring.Replace('\r', ' '); combostring.Replace('\n', ' '); - str=combostring=combostring.Trim(); + if (m_bTrim) + combostring.Trim(); cbei.pszText = const_cast(combostring.GetString()); #ifdef HISTORYCOMBO_WITH_SYSIMAGELIST @@ -229,7 +232,8 @@ void CHistoryCombo::SaveHistory() //add the current item to the history CString sCurItem; GetWindowText(sCurItem); - sCurItem.Trim(); + if (m_bTrim) + sCurItem.Trim(); if (!sCurItem.IsEmpty()) AddString(sCurItem, 0); //save history to registry/inifile diff --git a/src/Utils/MiscUI/HistoryCombo.h b/src/Utils/MiscUI/HistoryCombo.h index 5a3bdd02d..5f54ab03a 100644 --- a/src/Utils/MiscUI/HistoryCombo.h +++ b/src/Utils/MiscUI/HistoryCombo.h @@ -124,6 +124,12 @@ public: */ BOOL RemoveSelectedItem(); + /** + * Disables trimming of strings in the combobox. Useful if the combo box is + * used e.g. for searching. + */ + void DisableTrimming() { m_bTrim = false; } + protected: /** * Will be called whenever the return key is pressed while the @@ -146,7 +152,5 @@ protected: TOOLINFO m_ToolInfo; BOOL m_ttShown; BOOL m_bDyn; + BOOL m_bTrim; }; - - - -- 2.11.4.GIT