/** * @file XTPSyntaxEditFindReplaceDlg.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPSYNTAXEDITFINDREPLACEDLG_H__) # define __XTPSYNTAXEDITFINDREPLACEDLG_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPSyntaxEditView; /** * @brief * This class implements the "Find and Replace" and "Find" dialogs * for a SyntaxEdit control. */ class _XTP_EXT_CLASS CXTPSyntaxEditFindReplaceDlg : public CDialog { /** @cond */ DECLARE_DYNAMIC(CXTPSyntaxEditFindReplaceDlg) /** @endcond */ public: /** * @brief * Default object constructor. * @param pParentWnd Pointer to a parent window. */ CXTPSyntaxEditFindReplaceDlg(CWnd* pParentWnd = NULL); int m_nSearchDirection; /**< Search Direction: 0-up, 1-down. */ BOOL m_bMatchWholeWord; /**< Match Whole Words option. */ BOOL m_bMatchCase; /**< Match Case option. */ CString m_csFindText; /**< Text to find. */ CString m_csReplaceText; /**< Text to replace. */ int m_nSearchHistoryCountMax; /**< Maximum number of search strings. */ /** @cond */ enum { IDD = XTP_IDD_EDIT_SEARCH_REPLACE }; CButton m_btnFindNext; CButton m_btnRadioUp; CButton m_btnRadioDown; CButton m_btnReplace; CButton m_btnReplaceAll; CComboBox m_wndFindCombo; CComboBox m_wndReplaceCombo; /** @endcond */ /** * @brief * Shows either a "Find and Replace" or "Find" dialog. If a window * has not been created, then this method will load a dialog template * from resources and create a modeless dialog. * @param pEditCtrl Pointer to a CXTPSyntaxEditControl object. * @param bReplaceDlg TRUE to create a "Find and Replace" dialog, * FALSE to create a "Find" dialog. * @return * TRUE if successful, otherwise FALSE. * @see * ShowWindow */ BOOL ShowDialog(CXTPSyntaxEditCtrl* pEditCtrl, BOOL bReplaceDlg = FALSE); /** * @brief * Gets the attached edit control. * @return * A pointer to the attached edit control. * @see * ShowDialog */ CXTPSyntaxEditCtrl* GetEdirControl() const; /** * @brief * Determines the type of dialog that was created. * @return * TRUE if a "Find and Replace" dialog was created, * FALSE if a "Find" dialog was created. * @see * ShowDialog */ BOOL IsReplaceDialog() const; /** * @brief * Gets the maximum allowed number of search strings for * find and replace comboboxes. * @return * The maximum allowed number of search strings for * find and replace comboboxes. * @see * SetSearchHistoryCountMax, LoadHistory, SaveHistory */ int GetSearchHistoryCountMax() const; /** * @brief * Sets the maximum allowed number of search strings for * find and replace comboboxes. * @param nMaxCount Maximum allowed number of search strings to be set for * find and replace comboboxes. * @see * GetSearchHistoryCountMax, LoadHistory, SaveHistory */ void SetSearchHistoryCountMax(int nMaxCount); protected: /** * @brief * Moves or adds a string to the top of history items (i.e. item 0). * @param csText Reference to the string to move or add. * @param arHistory Reference to the history array. */ void UpdateHistoryCombo(const CString& csText, CStringArray& arHistory); /** * @brief * Moves or adds a string to the top of history items (i.e. item 0). * @param csText Reference to the string to move or add. * @param arHistory Reference to the history array. * @param wndCombo Reference to the history combobox. */ void UpdateHistoryCombo(const CString& csText, CStringArray& arHistory, CComboBox& wndCombo); /** * @brief * Moves or adds a string to the top of history items (i.e. item 0). * @param csText Reference to the string to move or add. * @param wndCombo Reference to the history combobox. */ void UpdateHistoryCombo(const CString& csText, CComboBox& wndCombo); /** * @brief * Initializes a combobox from an array of strings. * @param arHistory Reference to an array of strings. * @param wndCombo Reference to a CComboBox object. * @see * LoadHistory */ void InitHistoryCombo(CStringArray& arHistory, CComboBox& wndCombo); /** * @brief * Loads from application profile history for find and replace * comboboxes and state for other dialog controls. * @return * TRUE if successful, otherwise FALSE. * @see * SaveHistory */ BOOL LoadHistory(); /** * @brief * Saves to application profile history for find and replace * comboboxes and state for other dialog controls. * @return * TRUE if successful, otherwise FALSE. * @see * LoadHistory */ BOOL SaveHistory(); /** * @brief * Updates the control state (i.e. enable/disable) for the * "Find", "Replace", and "Replace All" buttons. */ void EnableControls(); /** @cond */ protected: virtual void DoDataExchange(CDataExchange* pDX); virtual BOOL OnInitDialog(); virtual void OnCancel(); virtual void OnFinalRelease(); afx_msg void OnEditChangeComboFind(); afx_msg void OnSelendOkComboFind(); afx_msg void OnChkMatchWholeWord(); afx_msg void OnChkMatchCase(); afx_msg void OnRadioUp(); afx_msg void OnRadioDown(); afx_msg void OnBtnFindNext(); afx_msg void OnBtnReplace(); afx_msg void OnBtnReplaceAll(); afx_msg void OnEditChangeComboReplace(); afx_msg void OnSelendOkComboReplace(); DECLARE_MESSAGE_MAP() /** @endcond */ protected: BOOL m_bReplaceDlg; /**< Dialog type. */ CPoint m_ptWndPos; /**< Window position. */ CXTPSyntaxEditCtrl* m_pEditCtrl; /**< Pointer to the attached view. */ }; ////////////////////////////////////////////////////////////////////////// AFX_INLINE CXTPSyntaxEditCtrl* CXTPSyntaxEditFindReplaceDlg::GetEdirControl() const { return m_pEditCtrl; } AFX_INLINE BOOL CXTPSyntaxEditFindReplaceDlg::IsReplaceDialog() const { return m_bReplaceDlg; } AFX_INLINE int CXTPSyntaxEditFindReplaceDlg::GetSearchHistoryCountMax() const { return m_nSearchHistoryCountMax; } AFX_INLINE void CXTPSyntaxEditFindReplaceDlg::SetSearchHistoryCountMax(int nMaxCount) { m_nSearchHistoryCountMax = nMaxCount; } # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPSYNTAXEDITFINDREPLACEDLG_H__) /** @endcond */