OSDN Git Service

c098bebc20676e916239d976dff536d3ac4efb1d
[tortoisegit/TortoiseGitJp.git] / 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 \r
27 IMPLEMENT_DYNAMIC(CAboutDlg, CStandAloneDialog)\r
28 CAboutDlg::CAboutDlg(CWnd* pParent /*=NULL*/)\r
29         : CStandAloneDialog(CAboutDlg::IDD, pParent)\r
30 {\r
31 }\r
32 \r
33 CAboutDlg::~CAboutDlg()\r
34 {\r
35 }\r
36 \r
37 void CAboutDlg::DoDataExchange(CDataExchange* pDX)\r
38 {\r
39         CStandAloneDialog::DoDataExchange(pDX);\r
40         DDX_Control(pDX, IDC_WEBLINK, m_cWebLink);\r
41         DDX_Control(pDX, IDC_SUPPORTLINK, m_cSupportLink);\r
42 }\r
43 \r
44 BEGIN_MESSAGE_MAP(CAboutDlg, CStandAloneDialog)\r
45         ON_WM_TIMER()\r
46         ON_WM_MOUSEMOVE()\r
47         ON_BN_CLICKED(IDC_UPDATE, OnBnClickedUpdate)\r
48 END_MESSAGE_MAP()\r
49 \r
50 BOOL CAboutDlg::OnInitDialog()\r
51 {\r
52         CStandAloneDialog::OnInitDialog();\r
53 \r
54         // set the version string\r
55         CString temp;\r
56         const svn_version_t * svnver = svn_client_version();\r
57 \r
58         temp.Format(IDS_ABOUTVERSION, TSVN_VERMAJOR, TSVN_VERMINOR, TSVN_VERMICRO, TSVN_VERBUILD, _T(TSVN_PLATFORM), _T(TSVN_VERDATE), \r
59                 svnver->major, svnver->minor, svnver->patch, CString(svnver->tag), \r
60                 APR_MAJOR_VERSION, APR_MINOR_VERSION, APR_PATCH_VERSION,\r
61                 APU_MAJOR_VERSION, APU_MINOR_VERSION, APU_PATCH_VERSION,\r
62                 _T(NEON_VERSION),\r
63                 _T(OPENSSL_VERSION_TEXT),\r
64                 _T(ZLIB_VERSION));\r
65         SetDlgItemText(IDC_VERSIONABOUT, temp);\r
66         this->SetWindowText(_T("TortoiseSVN"));\r
67 \r
68         CPictureHolder tmpPic;\r
69         tmpPic.CreateFromBitmap(IDB_LOGOFLIPPED);\r
70         m_renderSrc.Create32BitFromPicture(&tmpPic,468,64);\r
71         m_renderDest.Create32BitFromPicture(&tmpPic,468,64);\r
72 \r
73         m_waterEffect.Create(468,64);\r
74         SetTimer(ID_EFFECTTIMER, 40, NULL);\r
75         SetTimer(ID_DROPTIMER, 1500, NULL);\r
76 \r
77         m_cWebLink.SetURL(_T("http://tortoisesvn.net"));\r
78         m_cSupportLink.SetURL(_T("http://tortoisesvn.tigris.org/donate.html"));\r
79 \r
80         CenterWindow(CWnd::FromHandle(hWndExplorer));\r
81         GetDlgItem(IDOK)->SetFocus();\r
82         return FALSE;\r
83 }\r
84 \r
85 void CAboutDlg::OnTimer(UINT_PTR nIDEvent)\r
86 {\r
87         if (nIDEvent == ID_EFFECTTIMER)\r
88         {\r
89                 m_waterEffect.Render((DWORD*)m_renderSrc.GetDIBits(), (DWORD*)m_renderDest.GetDIBits());\r
90                 CClientDC dc(this);\r
91                 CPoint ptOrigin(15,20);\r
92                 m_renderDest.Draw(&dc,ptOrigin);\r
93         }\r
94         if (nIDEvent == ID_DROPTIMER)\r
95         {\r
96                 CRect r;\r
97                 r.left = 15;\r
98                 r.top = 20;\r
99                 r.right = r.left + m_renderSrc.GetWidth();\r
100                 r.bottom = r.top + m_renderSrc.GetHeight();\r
101                 m_waterEffect.Blob(random(r.left,r.right), random(r.top, r.bottom), 5, 800, m_waterEffect.m_iHpage);\r
102         }\r
103         CStandAloneDialog::OnTimer(nIDEvent);\r
104 }\r
105 \r
106 void CAboutDlg::OnMouseMove(UINT nFlags, CPoint point)\r
107 {\r
108         CRect r;\r
109         r.left = 15;\r
110         r.top = 20;\r
111         r.right = r.left + m_renderSrc.GetWidth();\r
112         r.bottom = r.top + m_renderSrc.GetHeight();\r
113 \r
114         if(r.PtInRect(point) == TRUE)\r
115         {\r
116                 // dibs are drawn upside down...\r
117                 point.y -= 20;\r
118                 point.y = 64-point.y;\r
119 \r
120                 if (nFlags & MK_LBUTTON)\r
121                         m_waterEffect.Blob(point.x -15,point.y,10,1600,m_waterEffect.m_iHpage);\r
122                 else\r
123                         m_waterEffect.Blob(point.x -15,point.y,5,50,m_waterEffect.m_iHpage);\r
124 \r
125         }\r
126 \r
127 \r
128         CStandAloneDialog::OnMouseMove(nFlags, point);\r
129 }\r
130 \r
131 void CAboutDlg::OnBnClickedUpdate()\r
132 {\r
133         TCHAR com[MAX_PATH+100];\r
134         GetModuleFileName(NULL, com, MAX_PATH);\r
135         _tcscat_s(com, MAX_PATH+100, _T(" /command:updatecheck /visible"));\r
136 \r
137         CAppUtils::LaunchApplication(com, 0, false);\r
138 }\r