Apply backgroundcolors.patch
[TortoiseGit.git] / src / TortoiseMerge / FindDlg.h
blobd23945bfa91f8d4dd5cb3084613bb06c86422c37
1 // TortoiseGitMerge - a Diff/Patch program
3 // Copyright (C) 2023 - TortoiseGit
4 // Copyright (C) 2006-2007, 2010, 2013-2014, 2016, 2020 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #pragma once
21 #include "resource.h"
22 #include <afxcmn.h>
23 #include "HistoryCombo.h"
24 #include "StandAloneDlg.h"
25 #include "registry.h"
27 #define REPLACEMSGSTRINGW L"TortoiseGitMerge_FindReplace"
29 /**
30 * \ingroup TortoiseMerge
31 * Find dialog used in TortoiseMerge.
33 class CFindDlg : public CStandAloneDialog
35 DECLARE_DYNAMIC(CFindDlg)
37 public:
38 CFindDlg(CWnd* pParent = nullptr); // standard constructor
39 virtual ~CFindDlg();
40 void Create(CWnd* pParent = nullptr, int id = 0);
41 bool IsTerminating() const { return m_bTerminating; }
42 bool FindNext() const { return m_bFindNext; }
43 bool MatchCase() const { return !!m_bMatchCase; }
44 bool LimitToDiffs() const { return !!m_bLimitToDiffs; }
45 bool WholeWord() const { return !!m_bWholeWord; }
46 bool SearchUp() const { return !!m_bSearchUp; }
47 CString GetFindString() const { return m_FindCombo.GetString(); }
48 CString GetReplaceString() const { return m_ReplaceCombo.GetString(); }
49 void SetFindString(const CString& str) { if (!str.IsEmpty()) { m_FindCombo.SetWindowText(str); } }
50 void SetStatusText(const CString& str, COLORREF color = RGB(0, 0, 255));
51 void SetReadonly(bool bReadonly);
52 // Dialog Data
53 enum { IDD = IDD_FIND };
55 enum FindType
57 Find,
58 Count,
59 Replace,
60 ReplaceAll
63 protected:
64 void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support
66 DECLARE_MESSAGE_MAP()
67 virtual void OnCancel();
68 virtual void PostNcDestroy();
69 virtual void OnOK();
70 BOOL OnInitDialog() override;
71 afx_msg void OnCbnEditchangeFindcombo();
72 afx_msg void OnBnClickedCount();
73 afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd *pWnd, UINT nCtlColor);
74 afx_msg void OnBnClickedReplace();
75 afx_msg void OnBnClickedReplaceall();
76 void SaveWindowPos(CWnd* pParent);
77 private:
78 UINT m_FindMsg = 0;
79 bool m_bTerminating = false;
80 bool m_bFindNext;
81 BOOL m_bMatchCase;
82 BOOL m_bLimitToDiffs;
83 BOOL m_bWholeWord;
84 BOOL m_bSearchUp;
85 CHistoryCombo m_FindCombo;
86 CHistoryCombo m_ReplaceCombo;
87 CStatic m_FindStatus;
88 CWnd* m_pParent = nullptr;
89 CRegDWORD m_regMatchCase;
90 CRegDWORD m_regLimitToDiffs;
91 CRegDWORD m_regWholeWord;
92 COLORREF m_clrFindStatus;
93 bool m_bReadonly;
94 int m_id = 0;