Don't create the tooltips as topmost, and don't position them as topmost either but...
[TortoiseGit.git] / src / TortoiseMerge / RegexFilterDlg.cpp
blob38da4fc31e004ca6e6e13626b0550ec033a1b5ec
1 // TortoiseMerge - a Diff/Patch program
3 // Copyright (C) 2013-2014 - TortoiseSVN
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 "RegexFilterDlg.h"
22 #include <afxdialogex.h>
23 #include <regex>
26 // CRegexFilterDlg dialog
28 IMPLEMENT_DYNAMIC(CRegexFilterDlg, CDialogEx)
30 CRegexFilterDlg::CRegexFilterDlg(CWnd* pParent /*=NULL*/)
31 : CDialogEx(CRegexFilterDlg::IDD, pParent)
32 , m_sName(_T(""))
33 , m_sRegex(_T(""))
34 , m_sReplace(_T(""))
38 CRegexFilterDlg::~CRegexFilterDlg()
42 void CRegexFilterDlg::DoDataExchange(CDataExchange* pDX)
44 CDialogEx::DoDataExchange(pDX);
45 DDX_Text(pDX, IDC_NAME, m_sName);
46 DDX_Text(pDX, IDC_REGEX, m_sRegex);
47 DDX_Text(pDX, IDC_REPLACE, m_sReplace);
51 BEGIN_MESSAGE_MAP(CRegexFilterDlg, CDialogEx)
52 END_MESSAGE_MAP()
55 // CRegexFilterDlg message handlers
58 BOOL CRegexFilterDlg::OnInitDialog()
60 CDialogEx::OnInitDialog();
62 UpdateData(FALSE);
64 GetDlgItem(IDC_NAME)->SetFocus();
65 return FALSE; // return TRUE unless you set the focus to a control
66 // EXCEPTION: OCX Property Pages should return FALSE
69 void CRegexFilterDlg::OnOK()
71 UpdateData();
73 try
75 std::wregex r1 = std::wregex(m_sRegex);
76 UNREFERENCED_PARAMETER(r1);
78 catch (std::exception)
80 ShowEditBalloon(IDC_REGEX, IDS_ERR_INVALIDREGEX, IDS_ERR_ERROR);
81 return;
84 CDialog::OnOK();
87 void CRegexFilterDlg::ShowEditBalloon(UINT nIdControl, UINT nIdText, UINT nIdTitle, int nIcon)
89 CString text = CString(MAKEINTRESOURCE(nIdText));
90 CString title = CString(MAKEINTRESOURCE(nIdTitle));
91 EDITBALLOONTIP bt;
92 bt.cbStruct = sizeof(bt);
93 bt.pszText = text;
94 bt.pszTitle = title;
95 bt.ttiIcon = nIcon;
96 SendDlgItemMessage(nIdControl, EM_SHOWBALLOONTIP, 0, (LPARAM)&bt);