1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2014 - 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"
23 #include "afxdialogex.h"
25 #include "ProjectProperties.h"
27 // CBugtraqRegexTestDlg dialog
29 IMPLEMENT_DYNAMIC(CBugtraqRegexTestDlg
, CResizableStandAloneDialog
)
31 CBugtraqRegexTestDlg::CBugtraqRegexTestDlg(CWnd
* pParent
/*=nullptr*/)
32 : CResizableStandAloneDialog(CBugtraqRegexTestDlg::IDD
, pParent
)
36 CBugtraqRegexTestDlg::~CBugtraqRegexTestDlg()
40 void CBugtraqRegexTestDlg::DoDataExchange(CDataExchange
* pDX
)
42 CResizableStandAloneDialog::DoDataExchange(pDX
);
43 DDX_Text(pDX
, IDC_BUGTRAQLOGREGEX1
, m_sBugtraqRegex1
);
44 DDX_Text(pDX
, IDC_BUGTRAQLOGREGEX2
, m_sBugtraqRegex2
);
45 DDX_Control(pDX
, IDC_BUGTRAQLOGREGEX1
, m_BugtraqRegex1
);
46 DDX_Control(pDX
, IDC_BUGTRAQLOGREGEX2
, m_BugtraqRegex2
);
47 DDX_Control(pDX
, IDC_LOGMESSAGE
, m_cLogMessage
);
50 BEGIN_MESSAGE_MAP(CBugtraqRegexTestDlg
, CResizableStandAloneDialog
)
51 ON_EN_CHANGE(IDC_BUGTRAQLOGREGEX1
, &CBugtraqRegexTestDlg::OnEnChangeBugtraqlogregex1
)
52 ON_EN_CHANGE(IDC_BUGTRAQLOGREGEX2
, &CBugtraqRegexTestDlg::OnEnChangeBugtraqlogregex2
)
55 void CBugtraqRegexTestDlg::OnEnChangeBugtraqlogregex1()
60 void CBugtraqRegexTestDlg::OnEnChangeBugtraqlogregex2()
65 BOOL
CBugtraqRegexTestDlg::OnInitDialog()
67 CResizableStandAloneDialog::OnInitDialog();
68 CAppUtils::MarkWindowAsUnpinnable(m_hWnd
);
70 ProjectProperties projectprops
;
71 projectprops
.lProjectLanguage
= -1;
72 projectprops
.SetBugIDRe(m_sBugtraqRegex1
);
73 projectprops
.SetCheckRe(m_sBugtraqRegex2
);
75 m_cLogMessage
.Init(projectprops
);
76 m_cLogMessage
.SetFont((CString
)CRegString(_T("Software\\TortoiseGit\\LogFontName"), _T("Courier New")), (DWORD
)CRegDWORD(_T("Software\\TortoiseGit\\LogFontSize"), 8));
78 m_cLogMessage
.SetText(CString(MAKEINTRESOURCE(IDS_SAMPLEBUGTRAQTESTMSG
)));
79 m_cLogMessage
.Call(SCI_SETCURRENTPOS
, 0);
80 m_cLogMessage
.Call(SCI_SETSEL
, 0, 0);
82 AddAnchor(IDC_SAMPLELABEL
, TOP_LEFT
, TOP_RIGHT
);
83 AddAnchor(IDC_LOGMESSAGE
, TOP_LEFT
, BOTTOM_RIGHT
);
84 AddAnchor(IDC_REGEXIDLABEL
, BOTTOM_LEFT
);
85 AddAnchor(IDC_BUGTRAQLOGREGEX1
, BOTTOM_LEFT
, BOTTOM_RIGHT
);
86 AddAnchor(IDC_REGEXMSGLABEL
, BOTTOM_LEFT
);
87 AddAnchor(IDC_BUGTRAQLOGREGEX2
, BOTTOM_LEFT
, BOTTOM_RIGHT
);
88 AddAnchor(IDOK
, BOTTOM_RIGHT
);
89 AddAnchor(IDCANCEL
, BOTTOM_RIGHT
);
94 void CBugtraqRegexTestDlg::UpdateLogControl()
96 if (m_BugtraqRegex1
.IsValidRegex() && m_BugtraqRegex2
.IsValidRegex())
99 ProjectProperties projectprops
;
100 projectprops
.lProjectLanguage
= -1;
101 projectprops
.SetBugIDRe(m_sBugtraqRegex1
.Trim());
102 projectprops
.SetCheckRe(m_sBugtraqRegex2
.Trim());
103 m_cLogMessage
.Init(projectprops
);
104 m_cLogMessage
.RestyleBugIDs();