1
// TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2014-2016 - 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
)
52 ON_WM_SYSCOLORCHANGE()
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(CAppUtils::GetLogFontName(), CAppUtils::GetLogFontSize());
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();
108 void CBugtraqRegexTestDlg::OnSysColorChange()
110 __super::OnSysColorChange();
112 m_cLogMessage
.SetColors(true);
113 m_cLogMessage
.SetFont(CAppUtils::GetLogFontName(), CAppUtils::GetLogFontSize());