1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2003-2007 - Stefan Kueng
\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
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
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
20 #include "Resource.h"
\r
21 #include "FindBar.h"
\r
22 #include "Registry.h"
\r
24 #include <Commdlg.h>
\r
26 using namespace std;
\r
28 CFindBar::CFindBar()
\r
32 CFindBar::~CFindBar(void)
\r
34 DestroyIcon(m_hIcon);
\r
37 LRESULT CFindBar::DlgFunc(HWND /*hwndDlg*/, UINT uMsg, WPARAM wParam, LPARAM lParam)
\r
39 UNREFERENCED_PARAMETER(lParam);
\r
44 m_hIcon = (HICON)::LoadImage(hResource, MAKEINTRESOURCE(IDI_CANCELNORMAL), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
\r
45 SendMessage(GetDlgItem(*this, IDC_FINDEXIT), BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_hIcon);
\r
49 return DoCommand(LOWORD(wParam), HIWORD(wParam));
\r
55 LRESULT CFindBar::DoCommand(int id, int msg)
\r
57 bool bFindPrev = false;
\r
69 ::SendMessage(m_hParent, COMMITMONITOR_FINDEXIT, 0, 0);
\r
74 if (msg == EN_CHANGE)
\r
76 SendMessage(m_hParent, COMMITMONITOR_FINDRESET, 0, 0);
\r
85 void CFindBar::DoFind(bool bFindPrev)
\r
87 int len = ::GetWindowTextLength(GetDlgItem(*this, IDC_FINDTEXT));
\r
88 TCHAR * findtext = new TCHAR[len+1];
\r
89 ::GetWindowText(GetDlgItem(*this, IDC_FINDTEXT), findtext, len+1);
\r
90 wstring ft = wstring(findtext);
\r
92 bool bCaseSensitive = !!SendMessage(GetDlgItem(*this, IDC_MATCHCASECHECK), BM_GETCHECK, 0, NULL);
\r
94 ::SendMessage(m_hParent, COMMITMONITOR_FINDMSGPREV, (WPARAM)bCaseSensitive, (LPARAM)ft.c_str());
\r
96 ::SendMessage(m_hParent, COMMITMONITOR_FINDMSGNEXT, (WPARAM)bCaseSensitive, (LPARAM)ft.c_str());
\r