Fixed issue #1507: Submodule Diff Dialog should show dirty state only on working...
[TortoiseGit.git] / src / TortoiseMerge / FindDlg.cpp
blob5dad9b64eeb4728f7c138f1bd79c2a439f657835
1 // TortoiseMerge - a Diff/Patch program
3 // Copyright (C) 2006 - Stefan Kueng
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include "stdafx.h"
20 #include "TortoiseMerge.h"
21 #include "FindDlg.h"
24 // CFindDlg dialog
26 IMPLEMENT_DYNAMIC(CFindDlg, CDialog)
28 CFindDlg::CFindDlg(CWnd* pParent /*=NULL*/)
29 : CDialog(CFindDlg::IDD, pParent)
30 , m_bTerminating(false)
31 , m_bFindNext(false)
32 , m_bMatchCase(FALSE)
33 , m_bLimitToDiffs(FALSE)
34 , m_bWholeWord(FALSE)
38 CFindDlg::~CFindDlg()
42 void CFindDlg::DoDataExchange(CDataExchange* pDX)
44 CDialog::DoDataExchange(pDX);
45 DDX_Check(pDX, IDC_MATCHCASE, m_bMatchCase);
46 DDX_Check(pDX, IDC_LIMITTODIFFS, m_bLimitToDiffs);
47 DDX_Check(pDX, IDC_WHOLEWORD, m_bWholeWord);
48 DDX_Control(pDX, IDC_FINDCOMBO, m_FindCombo);
52 BEGIN_MESSAGE_MAP(CFindDlg, CDialog)
53 ON_CBN_EDITCHANGE(IDC_FINDCOMBO, &CFindDlg::OnCbnEditchangeFindcombo)
54 END_MESSAGE_MAP()
57 // CFindDlg message handlers
59 void CFindDlg::OnCancel()
61 m_bTerminating = true;
62 if (GetParent())
63 GetParent()->SendMessage(m_FindMsg);
64 DestroyWindow();
67 void CFindDlg::PostNcDestroy()
69 delete this;
72 void CFindDlg::OnOK()
74 UpdateData();
75 m_FindCombo.SaveHistory();
77 if (m_FindCombo.GetString().IsEmpty())
78 return;
79 m_bFindNext = true;
80 if (GetParent())
81 GetParent()->SendMessage(m_FindMsg);
82 m_bFindNext = false;
85 BOOL CFindDlg::OnInitDialog()
87 CDialog::OnInitDialog();
88 m_FindMsg = RegisterWindowMessage(FINDMSGSTRING);
90 m_FindCombo.LoadHistory(_T("Software\\TortoiseMerge\\History\\Find"), _T("Search"));
92 m_FindCombo.SetFocus();
94 return FALSE;
97 void CFindDlg::OnCbnEditchangeFindcombo()
99 UpdateData();
100 GetDlgItem(IDOK)->EnableWindow(!m_FindCombo.GetString().IsEmpty());