1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
4 // Copyright (C) 2009-2016 - TortoiseGit
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.
22 #include "TortoiseProc.h"
24 #include "PathUtils.h"
25 #define NEED_SIGNING_KEY
26 #include "..\version.h"
30 //IMPLEMENT_DYNAMIC(CAboutDlg, CStandAloneDialog)
31 CAboutDlg::CAboutDlg(CWnd
* pParent
/*=nullptr*/)
32 : CStandAloneDialog(CAboutDlg::IDD
, pParent
)
36 CAboutDlg::~CAboutDlg()
40 void CAboutDlg::DoDataExchange(CDataExchange
* pDX
)
42 CStandAloneDialog::DoDataExchange(pDX
);
43 DDX_Control(pDX
, IDC_WEBLINK
, m_cWebLink
);
44 DDX_Control(pDX
, IDC_SUPPORTLINK
, m_cSupportLink
);
47 BEGIN_MESSAGE_MAP(CAboutDlg
, CStandAloneDialog
)
50 ON_BN_CLICKED(IDC_UPDATE
, OnBnClickedUpdate
)
53 static CString
Lf2Crlf(const CString
& text
)
60 for (int i
= 0; i
< text
.GetLength(); i
++)
62 if (text
[i
] == '\n' && c
!= '\r')
71 BOOL
CAboutDlg::OnInitDialog()
73 CStandAloneDialog::OnInitDialog();
74 CAppUtils::MarkWindowAsUnpinnable(m_hWnd
);
76 // set the version string
79 CString cmd
, out
, err
;
80 cmd
=_T("git.exe --version");
81 if (g_Git
.Run(cmd
, &out
, &err
, CP_UTF8
))
82 out
= _T("git not found (") + err
+ _T(")");;
85 if (!CGit::ms_LastMsysGitDir
.IsEmpty())
87 out
+= _T(" (") + CGit::ms_LastMsysGitDir
;
88 out
+= L
"; " + CGit::ms_MsysGitRootDir
;
89 out
+= L
"; " + g_Git
.GetGitSystemConfig();
90 if (CGit::ms_bMsys2Git
)
91 out
+= _T("; with msys2 hack");
92 else if (CGit::ms_bCygwinGit
)
93 out
+= _T("; with cygwin hack");
95 out
+= L
"; " + g_Git
.GetGitProgramDataConfig();
99 CString tortoisegitprocpath
;
100 tortoisegitprocpath
.Format(_T("(%s)"), (LPCTSTR
)CPathUtils::GetAppDirectory().TrimRight(_T('\\')));
101 temp
.Format(IDS_ABOUTVERSION
, TGIT_VERMAJOR
, TGIT_VERMINOR
, TGIT_VERMICRO
, TGIT_VERBUILD
, (LPCTSTR
)tortoisegitprocpath
, (LPCTSTR
)out
);
102 SetDlgItemText(IDC_VERSIONABOUT
, Lf2Crlf(temp
));
104 this->SetWindowText(_T("TortoiseGit"));
106 // we can only put up to 256 chars into the resource file, so fill it here with the full list
107 SetDlgItemText(IDC_STATIC_AUTHORS
, L
"Sven Strickroth <email@cs-ware.de> (Current Maintainer), Sup Yut Sum <ch3cooli@gmail.com>, Frank Li <lznuaa@gmail.com> (Founder), Yue Lin Ho <b8732003@student.nsysu.edu.tw>, Colin Law <clanlaw@googlemail.com>, Myagi <snowcoder@gmail.com>, Johan 't Hart <johanthart@gmail.com>, Laszlo Papp <djszapi@archlinux.us>");
109 CPictureHolder tmpPic
;
110 tmpPic
.CreateFromBitmap(IDB_LOGOFLIPPED
);
111 m_renderSrc
.Create32BitFromPicture(&tmpPic
,468,64);
112 m_renderDest
.Create32BitFromPicture(&tmpPic
,468,64);
114 m_waterEffect
.Create(468,64);
115 SetTimer(ID_EFFECTTIMER
, 40, nullptr);
116 SetTimer(ID_DROPTIMER
, 1500, nullptr);
118 m_cWebLink
.SetURL(_T("https://tortoisegit.org/"));
119 m_cSupportLink
.SetURL(_T("https://tortoisegit.org/donate"));
121 CenterWindow(CWnd::FromHandle(hWndExplorer
));
122 GetDlgItem(IDOK
)->SetFocus();
126 void CAboutDlg::OnTimer(UINT_PTR nIDEvent
)
128 if (nIDEvent
== ID_EFFECTTIMER
)
130 m_waterEffect
.Render((DWORD
*)m_renderSrc
.GetDIBits(), (DWORD
*)m_renderDest
.GetDIBits());
132 CPoint
ptOrigin(15,20);
133 m_renderDest
.Draw(&dc
,ptOrigin
);
135 if (nIDEvent
== ID_DROPTIMER
)
140 r
.right
= r
.left
+ m_renderSrc
.GetWidth();
141 r
.bottom
= r
.top
+ m_renderSrc
.GetHeight();
142 m_waterEffect
.Blob(random(r
.left
,r
.right
), random(r
.top
, r
.bottom
), 5, 800, m_waterEffect
.m_iHpage
);
144 CStandAloneDialog::OnTimer(nIDEvent
);
147 void CAboutDlg::OnMouseMove(UINT nFlags
, CPoint point
)
152 r
.right
= r
.left
+ m_renderSrc
.GetWidth();
153 r
.bottom
= r
.top
+ m_renderSrc
.GetHeight();
155 if(r
.PtInRect(point
) == TRUE
)
157 // dibs are drawn upside down...
159 point
.y
= 64-point
.y
;
161 if (nFlags
& MK_LBUTTON
)
162 m_waterEffect
.Blob(point
.x
-15,point
.y
,10,1600,m_waterEffect
.m_iHpage
);
164 m_waterEffect
.Blob(point
.x
-15,point
.y
,5,50,m_waterEffect
.m_iHpage
);
167 CStandAloneDialog::OnMouseMove(nFlags
, point
);
170 void CAboutDlg::OnBnClickedUpdate()
172 CAppUtils::RunTortoiseGitProc(_T("/command:updatecheck /visible"), false, false);