OSDN Git Service

Fix merge miss branch info
[tortoisegit/TortoiseGitJp.git] / src / TortoiseMerge / FindDlg.cpp
1 // TortoiseMerge - a Diff/Patch program\r
2 \r
3 // Copyright (C) 2006 - Stefan Kueng\r
4 \r
5 // This program is free software; you can redistribute it and/or\r
6 // modify it under the terms of the GNU General Public License\r
7 // as published by the Free Software Foundation; either version 2\r
8 // of the License, or (at your option) any later version.\r
9 \r
10 // This program is distributed in the hope that it will be useful,\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13 // GNU General Public License for more details.\r
14 \r
15 // You should have received a copy of the GNU General Public License\r
16 // along with this program; if not, write to the Free Software Foundation,\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
18 //\r
19 #include "stdafx.h"\r
20 #include "TortoiseMerge.h"\r
21 #include "FindDlg.h"\r
22 \r
23 \r
24 // CFindDlg dialog\r
25 \r
26 IMPLEMENT_DYNAMIC(CFindDlg, CDialog)\r
27 \r
28 CFindDlg::CFindDlg(CWnd* pParent /*=NULL*/)\r
29         : CDialog(CFindDlg::IDD, pParent)\r
30         , m_bTerminating(false)\r
31         , m_bFindNext(false)\r
32         , m_bMatchCase(FALSE)\r
33         , m_bLimitToDiffs(FALSE)\r
34         , m_bWholeWord(FALSE)\r
35 {\r
36 }\r
37 \r
38 CFindDlg::~CFindDlg()\r
39 {\r
40 }\r
41 \r
42 void CFindDlg::DoDataExchange(CDataExchange* pDX)\r
43 {\r
44         CDialog::DoDataExchange(pDX);\r
45         DDX_Check(pDX, IDC_MATCHCASE, m_bMatchCase);\r
46         DDX_Check(pDX, IDC_LIMITTODIFFS, m_bLimitToDiffs);\r
47         DDX_Check(pDX, IDC_WHOLEWORD, m_bWholeWord);\r
48         DDX_Control(pDX, IDC_FINDCOMBO, m_FindCombo);\r
49 }\r
50 \r
51 \r
52 BEGIN_MESSAGE_MAP(CFindDlg, CDialog)\r
53         ON_CBN_EDITCHANGE(IDC_FINDCOMBO, &CFindDlg::OnCbnEditchangeFindcombo)\r
54 END_MESSAGE_MAP()\r
55 \r
56 \r
57 // CFindDlg message handlers\r
58 \r
59 void CFindDlg::OnCancel()\r
60 {\r
61         m_bTerminating = true;\r
62         if (GetParent())\r
63                 GetParent()->SendMessage(m_FindMsg);\r
64         DestroyWindow();\r
65 }\r
66 \r
67 void CFindDlg::PostNcDestroy()\r
68 {\r
69         delete this;\r
70 }\r
71 \r
72 void CFindDlg::OnOK()\r
73 {\r
74         UpdateData();\r
75         m_FindCombo.SaveHistory();\r
76 \r
77         if (m_FindCombo.GetString().IsEmpty())\r
78                 return;\r
79         m_bFindNext = true;\r
80         if (GetParent())\r
81                 GetParent()->SendMessage(m_FindMsg);\r
82         m_bFindNext = false;\r
83 }\r
84 \r
85 BOOL CFindDlg::OnInitDialog()\r
86 {\r
87         CDialog::OnInitDialog();\r
88         m_FindMsg = RegisterWindowMessage(FINDMSGSTRING);\r
89 \r
90         m_FindCombo.LoadHistory(_T("Software\\TortoiseMerge\\History\\Find"), _T("Search"));\r
91 \r
92         m_FindCombo.SetFocus();\r
93 \r
94         return FALSE;\r
95 }\r
96 \r
97 void CFindDlg::OnCbnEditchangeFindcombo()\r
98 {\r
99         UpdateData();\r
100         GetDlgItem(IDOK)->EnableWindow(!m_FindCombo.GetString().IsEmpty());\r
101 }\r