OSDN Git Service

Pick Ref: Implemented ref picking for push dialog
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / AboutDlg.cpp
1 // TortoiseSVN - a Windows shell extension for easy version control\r
2 \r
3 // Copyright (C) 2003-2008 - TortoiseSVN\r
4 \r
5 // This program is free software; you can redistribute it and/or\r
6 // modify it under the terms of the GNU General Public License\r
7 // as published by the Free Software Foundation; either version 2\r
8 // of the License, or (at your option) any later version.\r
9 \r
10 // This program is distributed in the hope that it will be useful,\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13 // GNU General Public License for more details.\r
14 \r
15 // You should have received a copy of the GNU General Public License\r
16 // along with this program; if not, write to the Free Software Foundation,\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
18 //\r
19 \r
20 #include "stdafx.h"\r
21 #include "TortoiseProc.h"\r
22 #include "AboutDlg.h"\r
23 //#include "svn_version.h"\r
24 #include "..\version.h"\r
25 //#include "AppUtils.h"\r
26 #include "git.h"\r
27 \r
28 //IMPLEMENT_DYNAMIC(CAboutDlg, CStandAloneDialog)\r
29 CAboutDlg::CAboutDlg(CWnd* pParent /*=NULL*/)\r
30         : CStandAloneDialog(CAboutDlg::IDD, pParent)\r
31 {\r
32 }\r
33 \r
34 CAboutDlg::~CAboutDlg()\r
35 {\r
36 }\r
37 \r
38 void CAboutDlg::DoDataExchange(CDataExchange* pDX)\r
39 {\r
40         CStandAloneDialog::DoDataExchange(pDX);\r
41         DDX_Control(pDX, IDC_WEBLINK, m_cWebLink);\r
42         DDX_Control(pDX, IDC_SUPPORTLINK, m_cSupportLink);\r
43 }\r
44 \r
45 BEGIN_MESSAGE_MAP(CAboutDlg, CStandAloneDialog)\r
46         ON_WM_TIMER()\r
47         ON_WM_MOUSEMOVE()\r
48         ON_BN_CLICKED(IDC_UPDATE, OnBnClickedUpdate)\r
49 END_MESSAGE_MAP()\r
50 \r
51 BOOL CAboutDlg::OnInitDialog()\r
52 {\r
53         CStandAloneDialog::OnInitDialog();\r
54 \r
55         // set the version string\r
56         CString temp;\r
57 \r
58         CString cmd,out;\r
59         cmd=_T("git.exe --version");\r
60         if(g_Git.Run(cmd,&out,CP_ACP))\r
61                 out=_T("git not found");\r
62         int start =0;\r
63         out=out.Tokenize(_T("\n"),start);\r
64 \r
65         temp.Format(IDS_ABOUTVERSION, TSVN_VERMAJOR, TSVN_VERMINOR, TSVN_VERMICRO, TSVN_VERBUILD,out);\r
66 #if 0\r
67         const svn_version_t * svnver = svn_client_version();\r
68 \r
69         temp.Format(IDS_ABOUTVERSION, TSVN_VERMAJOR, TSVN_VERMINOR, TSVN_VERMICRO, TSVN_VERBUILD, _T(TSVN_PLATFORM), _T(TSVN_VERDATE), \r
70                 svnver->major, svnver->minor, svnver->patch, CString(svnver->tag), \r
71                 APR_MAJOR_VERSION, APR_MINOR_VERSION, APR_PATCH_VERSION,\r
72                 APU_MAJOR_VERSION, APU_MINOR_VERSION, APU_PATCH_VERSION,\r
73                 _T(NEON_VERSION),\r
74                 _T(OPENSSL_VERSION_TEXT),\r
75                 _T(ZLIB_VERSION));\r
76 #endif\r
77         SetDlgItemText(IDC_VERSIONABOUT, temp);\r
78 \r
79         this->SetWindowText(_T("TortoiseGit"));\r
80 \r
81         CPictureHolder tmpPic;\r
82         tmpPic.CreateFromBitmap(IDB_LOGOFLIPPED);\r
83         m_renderSrc.Create32BitFromPicture(&tmpPic,468,64);\r
84         m_renderDest.Create32BitFromPicture(&tmpPic,468,64);\r
85 \r
86         m_waterEffect.Create(468,64);\r
87         SetTimer(ID_EFFECTTIMER, 40, NULL);\r
88         SetTimer(ID_DROPTIMER, 1500, NULL);\r
89 \r
90         m_cWebLink.SetURL(_T("http://code.google.com/p/tortoisegit/"));\r
91         m_cSupportLink.SetURL(_T("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=GJGTG75GV5PL6&lc=C2&item_name=TortoiseGit&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"));\r
92 \r
93         CenterWindow(CWnd::FromHandle(hWndExplorer));\r
94         GetDlgItem(IDOK)->SetFocus();\r
95         return FALSE;\r
96 }\r
97 \r
98 void CAboutDlg::OnTimer(UINT_PTR nIDEvent)\r
99 {\r
100         if (nIDEvent == ID_EFFECTTIMER)\r
101         {\r
102                 m_waterEffect.Render((DWORD*)m_renderSrc.GetDIBits(), (DWORD*)m_renderDest.GetDIBits());\r
103                 CClientDC dc(this);\r
104                 CPoint ptOrigin(15,20);\r
105                 m_renderDest.Draw(&dc,ptOrigin);\r
106         }\r
107         if (nIDEvent == ID_DROPTIMER)\r
108         {\r
109                 CRect r;\r
110                 r.left = 15;\r
111                 r.top = 20;\r
112                 r.right = r.left + m_renderSrc.GetWidth();\r
113                 r.bottom = r.top + m_renderSrc.GetHeight();\r
114                 m_waterEffect.Blob(random(r.left,r.right), random(r.top, r.bottom), 5, 800, m_waterEffect.m_iHpage);\r
115         }\r
116         CStandAloneDialog::OnTimer(nIDEvent);\r
117 }\r
118 \r
119 void CAboutDlg::OnMouseMove(UINT nFlags, CPoint point)\r
120 {\r
121         CRect r;\r
122         r.left = 15;\r
123         r.top = 20;\r
124         r.right = r.left + m_renderSrc.GetWidth();\r
125         r.bottom = r.top + m_renderSrc.GetHeight();\r
126 \r
127         if(r.PtInRect(point) == TRUE)\r
128         {\r
129                 // dibs are drawn upside down...\r
130                 point.y -= 20;\r
131                 point.y = 64-point.y;\r
132 \r
133                 if (nFlags & MK_LBUTTON)\r
134                         m_waterEffect.Blob(point.x -15,point.y,10,1600,m_waterEffect.m_iHpage);\r
135                 else\r
136                         m_waterEffect.Blob(point.x -15,point.y,5,50,m_waterEffect.m_iHpage);\r
137 \r
138         }\r
139 \r
140 \r
141         CStandAloneDialog::OnMouseMove(nFlags, point);\r
142 }\r
143 \r
144 void CAboutDlg::OnBnClickedUpdate()\r
145 {\r
146         TCHAR com[MAX_PATH+100];\r
147         GetModuleFileName(NULL, com, MAX_PATH);\r
148         _tcscat_s(com, MAX_PATH+100, _T(" /command:updatecheck /visible"));\r
149 \r
150 //      CAppUtils::LaunchApplication(com, 0, false);\r
151 }\r