1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2014-2015 - 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 "TortoiseProc.h"
22 #include "BugtraqRegexTestDlg.h"
24 #include "ProjectProperties.h"
26 // CBugtraqRegexTestDlg dialog
28 IMPLEMENT_DYNAMIC(CBugtraqRegexTestDlg
, CResizableStandAloneDialog
)
30 CBugtraqRegexTestDlg::CBugtraqRegexTestDlg(CWnd
* pParent
/*=nullptr*/)
31 : CResizableStandAloneDialog(CBugtraqRegexTestDlg::IDD
, pParent
)
35 CBugtraqRegexTestDlg::~CBugtraqRegexTestDlg()
39 void CBugtraqRegexTestDlg::DoDataExchange(CDataExchange
* pDX
)
41 CResizableStandAloneDialog::DoDataExchange(pDX
);
42 DDX_Text(pDX
, IDC_BUGTRAQLOGREGEX1
, m_sBugtraqRegex1
);
43 DDX_Text(pDX
, IDC_BUGTRAQLOGREGEX2
, m_sBugtraqRegex2
);
44 DDX_Control(pDX
, IDC_BUGTRAQLOGREGEX1
, m_BugtraqRegex1
);
45 DDX_Control(pDX
, IDC_BUGTRAQLOGREGEX2
, m_BugtraqRegex2
);
46 DDX_Control(pDX
, IDC_LOGMESSAGE
, m_cLogMessage
);
49 BEGIN_MESSAGE_MAP(CBugtraqRegexTestDlg
, CResizableStandAloneDialog
)
50 ON_EN_CHANGE(IDC_BUGTRAQLOGREGEX1
, &CBugtraqRegexTestDlg::OnEnChangeBugtraqlogregex1
)
51 ON_EN_CHANGE(IDC_BUGTRAQLOGREGEX2
, &CBugtraqRegexTestDlg::OnEnChangeBugtraqlogregex2
)
54 void CBugtraqRegexTestDlg::OnEnChangeBugtraqlogregex1()
59 void CBugtraqRegexTestDlg::OnEnChangeBugtraqlogregex2()
64 BOOL
CBugtraqRegexTestDlg::OnInitDialog()
66 CResizableStandAloneDialog::OnInitDialog();
67 CAppUtils::MarkWindowAsUnpinnable(m_hWnd
);
69 ProjectProperties projectprops
;
70 projectprops
.lProjectLanguage
= -1;
71 projectprops
.SetBugIDRe(m_sBugtraqRegex1
);
72 projectprops
.SetCheckRe(m_sBugtraqRegex2
);
74 m_cLogMessage
.Init(projectprops
);
75 m_cLogMessage
.SetFont((CString
)CRegString(_T("Software\\TortoiseGit\\LogFontName"), _T("Courier New")), (DWORD
)CRegDWORD(_T("Software\\TortoiseGit\\LogFontSize"), 8));
77 m_cLogMessage
.SetText(CString(MAKEINTRESOURCE(IDS_SAMPLEBUGTRAQTESTMSG
)));
78 m_cLogMessage
.Call(SCI_SETCURRENTPOS
, 0);
79 m_cLogMessage
.Call(SCI_SETSEL
, 0, 0);
81 AddAnchor(IDC_SAMPLELABEL
, TOP_LEFT
, TOP_RIGHT
);
82 AddAnchor(IDC_LOGMESSAGE
, TOP_LEFT
, BOTTOM_RIGHT
);
83 AddAnchor(IDC_REGEXIDLABEL
, BOTTOM_LEFT
);
84 AddAnchor(IDC_BUGTRAQLOGREGEX1
, BOTTOM_LEFT
, BOTTOM_RIGHT
);
85 AddAnchor(IDC_REGEXMSGLABEL
, BOTTOM_LEFT
);
86 AddAnchor(IDC_BUGTRAQLOGREGEX2
, BOTTOM_LEFT
, BOTTOM_RIGHT
);
87 AddAnchor(IDOK
, BOTTOM_RIGHT
);
88 AddAnchor(IDCANCEL
, BOTTOM_RIGHT
);
93 void CBugtraqRegexTestDlg::UpdateLogControl()
95 if (m_BugtraqRegex1
.IsValidRegex() && m_BugtraqRegex2
.IsValidRegex())
98 ProjectProperties projectprops
;
99 projectprops
.lProjectLanguage
= -1;
100 projectprops
.SetBugIDRe(m_sBugtraqRegex1
.Trim());
101 projectprops
.SetCheckRe(m_sBugtraqRegex2
.Trim());
102 m_cLogMessage
.Init(projectprops
);
103 m_cLogMessage
.RestyleBugIDs();