Dropped unused includes
[TortoiseGit.git] / src / TortoiseProc / AboutDlg.cpp
blobcfa56ba3d70dc332bf6a102238e0c970662c69bc
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - 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.
20 #include "stdafx.h"
21 #include "TortoiseProc.h"
22 #include "AboutDlg.h"
23 //#include "svn_version.h"
24 #include "..\version.h"
25 #include "AppUtils.h"
26 #include "git.h"
28 //IMPLEMENT_DYNAMIC(CAboutDlg, CStandAloneDialog)
29 CAboutDlg::CAboutDlg(CWnd* pParent /*=NULL*/)
30 : CStandAloneDialog(CAboutDlg::IDD, pParent)
34 CAboutDlg::~CAboutDlg()
38 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
40 CStandAloneDialog::DoDataExchange(pDX);
41 DDX_Control(pDX, IDC_WEBLINK, m_cWebLink);
42 DDX_Control(pDX, IDC_SUPPORTLINK, m_cSupportLink);
45 BEGIN_MESSAGE_MAP(CAboutDlg, CStandAloneDialog)
46 ON_WM_TIMER()
47 ON_WM_MOUSEMOVE()
48 ON_BN_CLICKED(IDC_UPDATE, OnBnClickedUpdate)
49 END_MESSAGE_MAP()
51 BOOL CAboutDlg::OnInitDialog()
53 CStandAloneDialog::OnInitDialog();
54 CAppUtils::MarkWindowAsUnpinnable(m_hWnd);
56 // set the version string
57 CString temp;
59 CString cmd, out, err;
60 cmd=_T("git.exe --version");
61 if (g_Git.Run(cmd, &out, &err, CP_UTF8))
62 out = _T("git not found (") + err + _T(")");;
63 int start =0;
64 out=out.Tokenize(_T("\n"),start);
66 CAppUtils::GetMsysgitVersion(&out);
67 if (!CGit::ms_LastMsysGitDir.IsEmpty())
68 out += _T(" (") + CGit::ms_LastMsysGitDir + _T(")");
70 temp.Format(IDS_ABOUTVERSION, TGIT_VERMAJOR, TGIT_VERMINOR, TGIT_VERMICRO, TGIT_VERBUILD,out);
71 #if 0
72 const svn_version_t * svnver = svn_client_version();
74 temp.Format(IDS_ABOUTVERSION, TSVN_VERMAJOR, TSVN_VERMINOR, TSVN_VERMICRO, TSVN_VERBUILD, _T(TSVN_PLATFORM), _T(TSVN_VERDATE),
75 svnver->major, svnver->minor, svnver->patch, CString(svnver->tag),
76 APR_MAJOR_VERSION, APR_MINOR_VERSION, APR_PATCH_VERSION,
77 APU_MAJOR_VERSION, APU_MINOR_VERSION, APU_PATCH_VERSION,
78 _T(NEON_VERSION),
79 _T(OPENSSL_VERSION_TEXT),
80 _T(ZLIB_VERSION));
81 #endif
82 SetDlgItemText(IDC_VERSIONABOUT, temp);
84 this->SetWindowText(_T("TortoiseGit"));
86 CPictureHolder tmpPic;
87 tmpPic.CreateFromBitmap(IDB_LOGOFLIPPED);
88 m_renderSrc.Create32BitFromPicture(&tmpPic,468,64);
89 m_renderDest.Create32BitFromPicture(&tmpPic,468,64);
91 m_waterEffect.Create(468,64);
92 SetTimer(ID_EFFECTTIMER, 40, NULL);
93 SetTimer(ID_DROPTIMER, 1500, NULL);
95 m_cWebLink.SetURL(_T("http://code.google.com/p/tortoisegit/"));
96 m_cSupportLink.SetURL(_T("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=GJGTG75GV5PL6&lc=C2&item_name=Donate%20To%20The%20TortoiseGit%20Project&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"));
98 CenterWindow(CWnd::FromHandle(hWndExplorer));
99 GetDlgItem(IDOK)->SetFocus();
100 return FALSE;
103 void CAboutDlg::OnTimer(UINT_PTR nIDEvent)
105 if (nIDEvent == ID_EFFECTTIMER)
107 m_waterEffect.Render((DWORD*)m_renderSrc.GetDIBits(), (DWORD*)m_renderDest.GetDIBits());
108 CClientDC dc(this);
109 CPoint ptOrigin(15,20);
110 m_renderDest.Draw(&dc,ptOrigin);
112 if (nIDEvent == ID_DROPTIMER)
114 CRect r;
115 r.left = 15;
116 r.top = 20;
117 r.right = r.left + m_renderSrc.GetWidth();
118 r.bottom = r.top + m_renderSrc.GetHeight();
119 m_waterEffect.Blob(random(r.left,r.right), random(r.top, r.bottom), 5, 800, m_waterEffect.m_iHpage);
121 CStandAloneDialog::OnTimer(nIDEvent);
124 void CAboutDlg::OnMouseMove(UINT nFlags, CPoint point)
126 CRect r;
127 r.left = 15;
128 r.top = 20;
129 r.right = r.left + m_renderSrc.GetWidth();
130 r.bottom = r.top + m_renderSrc.GetHeight();
132 if(r.PtInRect(point) == TRUE)
134 // dibs are drawn upside down...
135 point.y -= 20;
136 point.y = 64-point.y;
138 if (nFlags & MK_LBUTTON)
139 m_waterEffect.Blob(point.x -15,point.y,10,1600,m_waterEffect.m_iHpage);
140 else
141 m_waterEffect.Blob(point.x -15,point.y,5,50,m_waterEffect.m_iHpage);
146 CStandAloneDialog::OnMouseMove(nFlags, point);
149 void CAboutDlg::OnBnClickedUpdate()
151 CAppUtils::RunTortoiseGitProc(_T("/command:updatecheck /visible"), false, false);