Call CGit::DeleteRemoteRefs() to delete remote tags
[TortoiseGit.git] / src / TortoiseProc / AboutDlg.cpp
blob83787cb687b997758e48e9c1978337c7f645ee7a
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 static CString Lf2Crlf(const CString& text)
55 CString s;
56 if (text.GetLength() == 0)
57 return s;
59 TCHAR c = '\0';
60 for (int i = 0; i < text.GetLength(); i++)
62 if (text[i] == '\n' && c != '\r')
63 s += "\r\n";
64 else
65 s += text[i];
66 c = text[i];
68 return s;
71 BOOL CAboutDlg::OnInitDialog()
73 CStandAloneDialog::OnInitDialog();
74 CAppUtils::MarkWindowAsUnpinnable(m_hWnd);
76 // set the version string
77 CString temp;
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(")");;
83 out.Trim();
85 if (!CGit::ms_LastMsysGitDir.IsEmpty())
86 out += _T(" (") + CGit::ms_LastMsysGitDir + _T(")");
88 CString tortoisegitprocpath;
89 tortoisegitprocpath.Format(_T("(%s)"), CPathUtils::GetAppDirectory());
90 temp.Format(IDS_ABOUTVERSION, TGIT_VERMAJOR, TGIT_VERMINOR, TGIT_VERMICRO, TGIT_VERBUILD, tortoisegitprocpath, out);
91 SetDlgItemText(IDC_VERSIONABOUT, Lf2Crlf(temp));
93 this->SetWindowText(_T("TortoiseGit"));
95 CPictureHolder tmpPic;
96 tmpPic.CreateFromBitmap(IDB_LOGOFLIPPED);
97 m_renderSrc.Create32BitFromPicture(&tmpPic,468,64);
98 m_renderDest.Create32BitFromPicture(&tmpPic,468,64);
100 m_waterEffect.Create(468,64);
101 SetTimer(ID_EFFECTTIMER, 40, NULL);
102 SetTimer(ID_DROPTIMER, 1500, NULL);
104 m_cWebLink.SetURL(_T("http://tortoisegit.org/"));
105 m_cSupportLink.SetURL(_T("http://redir.tortoisegit.org/donate"));
107 CenterWindow(CWnd::FromHandle(hWndExplorer));
108 GetDlgItem(IDOK)->SetFocus();
109 return FALSE;
112 void CAboutDlg::OnTimer(UINT_PTR nIDEvent)
114 if (nIDEvent == ID_EFFECTTIMER)
116 m_waterEffect.Render((DWORD*)m_renderSrc.GetDIBits(), (DWORD*)m_renderDest.GetDIBits());
117 CClientDC dc(this);
118 CPoint ptOrigin(15,20);
119 m_renderDest.Draw(&dc,ptOrigin);
121 if (nIDEvent == ID_DROPTIMER)
123 CRect r;
124 r.left = 15;
125 r.top = 20;
126 r.right = r.left + m_renderSrc.GetWidth();
127 r.bottom = r.top + m_renderSrc.GetHeight();
128 m_waterEffect.Blob(random(r.left,r.right), random(r.top, r.bottom), 5, 800, m_waterEffect.m_iHpage);
130 CStandAloneDialog::OnTimer(nIDEvent);
133 void CAboutDlg::OnMouseMove(UINT nFlags, CPoint point)
135 CRect r;
136 r.left = 15;
137 r.top = 20;
138 r.right = r.left + m_renderSrc.GetWidth();
139 r.bottom = r.top + m_renderSrc.GetHeight();
141 if(r.PtInRect(point) == TRUE)
143 // dibs are drawn upside down...
144 point.y -= 20;
145 point.y = 64-point.y;
147 if (nFlags & MK_LBUTTON)
148 m_waterEffect.Blob(point.x -15,point.y,10,1600,m_waterEffect.m_iHpage);
149 else
150 m_waterEffect.Blob(point.x -15,point.y,5,50,m_waterEffect.m_iHpage);
155 CStandAloneDialog::OnMouseMove(nFlags, point);
158 void CAboutDlg::OnBnClickedUpdate()
160 CAppUtils::RunTortoiseGitProc(_T("/command:updatecheck /visible"), false, false);