1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2012 - TortoiseGit
4 // Copyright (C) 2011 - 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.
21 #include "RegexEdit.h"
26 IMPLEMENT_DYNAMIC(CRegexEdit
, CEdit
)
27 CRegexEdit::CRegexEdit()
32 CRegexEdit::~CRegexEdit()
36 BEGIN_MESSAGE_MAP(CRegexEdit
, CEdit
)
37 ON_WM_CTLCOLOR_REFLECT()
40 HBRUSH
CRegexEdit::CtlColor(CDC
* pDC
, UINT
/*nCtlColor*/)
42 bool oldState
= m_bValid
;
43 // check if the regex is valid
48 GetWindowText(sRegex
);
49 const std::tr1::wregex
regMatch(sRegex
, std::tr1::regex_constants::icase
| std::tr1::regex_constants::ECMAScript
);
51 catch (std::exception
)
58 pDC
->SetBkColor(GetSysColor(COLOR_3DFACE
) - RGB(0,20,20));
59 if (m_invalidBkgnd
.GetSafeHandle() == NULL
)
60 m_invalidBkgnd
.CreateSolidBrush(GetSysColor(COLOR_3DFACE
) - RGB(0,20,20));
61 return (HBRUSH
)m_invalidBkgnd
.GetSafeHandle();