Optical improvements
[TortoiseGit.git] / src / TortoiseProc / AboutDlg.cpp
blob753ef1b9dbe89693b026ff580799b8abb337d728
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
4 // Copyright (C) 2009-2013 - 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.
21 #include "stdafx.h"
22 #include "TortoiseProc.h"
23 #include "AboutDlg.h"
24 #include "PathUtils.h"
25 #define NEED_SIGNING_KEY
26 #include "..\version.h"
27 #include "AppUtils.h"
28 #include "Git.h"
30 //IMPLEMENT_DYNAMIC(CAboutDlg, CStandAloneDialog)
31 CAboutDlg::CAboutDlg(CWnd* pParent /*=NULL*/)
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)
48 ON_WM_TIMER()
49 ON_WM_MOUSEMOVE()
50 ON_BN_CLICKED(IDC_UPDATE, OnBnClickedUpdate)
51 END_MESSAGE_MAP()
53 BOOL CAboutDlg::OnInitDialog()
55 CStandAloneDialog::OnInitDialog();
56 CAppUtils::MarkWindowAsUnpinnable(m_hWnd);
58 // set the version string
59 CString temp;
61 CString cmd, out, err;
62 cmd=_T("git.exe --version");
63 if (g_Git.Run(cmd, &out, &err, CP_UTF8))
64 out = _T("git not found (") + err + _T(")");;
65 out.Trim();
67 if (!CGit::ms_LastMsysGitDir.IsEmpty())
68 out += _T(" (") + CGit::ms_LastMsysGitDir + _T(")");
70 CString tortoisegitprocpath;
71 tortoisegitprocpath.Format(_T("(%s)"), CPathUtils::GetAppDirectory());
72 temp.Format(IDS_ABOUTVERSION, TGIT_VERMAJOR, TGIT_VERMINOR, TGIT_VERMICRO, TGIT_VERBUILD, tortoisegitprocpath, out);
73 SetDlgItemText(IDC_VERSIONABOUT, temp);
75 this->SetWindowText(_T("TortoiseGit"));
77 CPictureHolder tmpPic;
78 tmpPic.CreateFromBitmap(IDB_LOGOFLIPPED);
79 m_renderSrc.Create32BitFromPicture(&tmpPic,468,64);
80 m_renderDest.Create32BitFromPicture(&tmpPic,468,64);
82 m_waterEffect.Create(468,64);
83 SetTimer(ID_EFFECTTIMER, 40, NULL);
84 SetTimer(ID_DROPTIMER, 1500, NULL);
86 m_cWebLink.SetURL(_T("http://tortoisegit.org/"));
87 m_cSupportLink.SetURL(_T("http://redir.tortoisegit.org/donate"));
89 CenterWindow(CWnd::FromHandle(hWndExplorer));
90 GetDlgItem(IDOK)->SetFocus();
91 return FALSE;
94 void CAboutDlg::OnTimer(UINT_PTR nIDEvent)
96 if (nIDEvent == ID_EFFECTTIMER)
98 m_waterEffect.Render((DWORD*)m_renderSrc.GetDIBits(), (DWORD*)m_renderDest.GetDIBits());
99 CClientDC dc(this);
100 CPoint ptOrigin(15,20);
101 m_renderDest.Draw(&dc,ptOrigin);
103 if (nIDEvent == ID_DROPTIMER)
105 CRect r;
106 r.left = 15;
107 r.top = 20;
108 r.right = r.left + m_renderSrc.GetWidth();
109 r.bottom = r.top + m_renderSrc.GetHeight();
110 m_waterEffect.Blob(random(r.left,r.right), random(r.top, r.bottom), 5, 800, m_waterEffect.m_iHpage);
112 CStandAloneDialog::OnTimer(nIDEvent);
115 void CAboutDlg::OnMouseMove(UINT nFlags, CPoint point)
117 CRect r;
118 r.left = 15;
119 r.top = 20;
120 r.right = r.left + m_renderSrc.GetWidth();
121 r.bottom = r.top + m_renderSrc.GetHeight();
123 if(r.PtInRect(point) == TRUE)
125 // dibs are drawn upside down...
126 point.y -= 20;
127 point.y = 64-point.y;
129 if (nFlags & MK_LBUTTON)
130 m_waterEffect.Blob(point.x -15,point.y,10,1600,m_waterEffect.m_iHpage);
131 else
132 m_waterEffect.Blob(point.x -15,point.y,5,50,m_waterEffect.m_iHpage);
137 CStandAloneDialog::OnMouseMove(nFlags, point);
140 void CAboutDlg::OnBnClickedUpdate()
142 CAppUtils::RunTortoiseGitProc(_T("/command:updatecheck /visible"), false, false);