OSDN Git Service

Fix init repos commit\show log problem.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseMerge / AboutDlg.cpp
1 // TortoiseMerge - a Diff/Patch program\r
2 \r
3 // Copyright (C) 2006-2007 - 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 #include "stdafx.h"\r
20 #include "TortoiseMerge.h"\r
21 #include "AboutDlg.h"\r
22 //#include "svn_version.h"\r
23 //#include "svn_diff.h"\r
24 //#include "..\..\\apr\include\apr_version.h"\r
25 //#include "..\..\apr-util\include\apu_version.h"\r
26 #include "..\version.h"\r
27 \r
28 // CAboutDlg dialog\r
29 \r
30 IMPLEMENT_DYNAMIC(CAboutDlg, CDialog)\r
31 CAboutDlg::CAboutDlg(CWnd* pParent /*=NULL*/)\r
32         : CDialog(CAboutDlg::IDD, pParent)\r
33 {\r
34         m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);\r
35 }\r
36 \r
37 CAboutDlg::~CAboutDlg()\r
38 {\r
39 }\r
40 \r
41 void CAboutDlg::DoDataExchange(CDataExchange* pDX)\r
42 {\r
43         CDialog::DoDataExchange(pDX);\r
44         DDX_Control(pDX, IDC_WEBLINK, m_cWebLink);\r
45         DDX_Control(pDX, IDC_SUPPORTLINK, m_cSupportLink);\r
46 }\r
47 \r
48 \r
49 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)\r
50         ON_WM_PAINT()\r
51         ON_WM_QUERYDRAGICON()\r
52         ON_WM_TIMER()\r
53         ON_WM_MOUSEMOVE()\r
54 END_MESSAGE_MAP()\r
55 \r
56 \r
57 void CAboutDlg::OnPaint() \r
58 {\r
59         if (IsIconic())\r
60         {\r
61                 CPaintDC dc(this); // device context for painting\r
62 \r
63                 SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);\r
64 \r
65                 // Center icon in client rectangle\r
66                 int cxIcon = GetSystemMetrics(SM_CXICON);\r
67                 int cyIcon = GetSystemMetrics(SM_CYICON);\r
68                 CRect rect;\r
69                 GetClientRect(&rect);\r
70                 int x = (rect.Width() - cxIcon + 1) / 2;\r
71                 int y = (rect.Height() - cyIcon + 1) / 2;\r
72 \r
73                 // Draw the icon\r
74                 dc.DrawIcon(x, y, m_hIcon);\r
75         }\r
76         else\r
77         {\r
78                 CDialog::OnPaint();\r
79         }\r
80 }\r
81 \r
82 // The system calls this function to obtain the cursor to display while the user drags\r
83 //  the minimized window.\r
84 HCURSOR CAboutDlg::OnQueryDragIcon()\r
85 {\r
86         return static_cast<HCURSOR>(m_hIcon);\r
87 }\r
88 \r
89 BOOL CAboutDlg::OnInitDialog()\r
90 {\r
91         CDialog::OnInitDialog();\r
92         // Set the icon for this dialog.  The framework does this automatically\r
93         //  when the application's main window is not a dialog\r
94         SetIcon(m_hIcon, TRUE);                 // Set big icon\r
95         SetIcon(m_hIcon, FALSE);                // Set small icon\r
96 #if 0\r
97         //set the version string\r
98         CString temp, boxtitle;\r
99         boxtitle.Format(IDS_ABOUTVERSIONBOX, TSVN_VERMAJOR, TSVN_VERMINOR, TSVN_VERMICRO, TSVN_VERBUILD, _T(TSVN_PLATFORM), _T(TSVN_VERDATE));\r
100         SetDlgItemText(IDC_VERSIONBOX, boxtitle);\r
101         const svn_version_t * diffver = svn_diff_version();\r
102         temp.Format(IDS_ABOUTVERSION, TSVN_VERMAJOR, TSVN_VERMINOR, TSVN_VERMICRO, TSVN_VERBUILD, _T(TSVN_PLATFORM), _T(TSVN_VERDATE),\r
103                 diffver->major, diffver->minor, diffver->patch, CString(diffver->tag), \r
104                 APR_MAJOR_VERSION, APR_MINOR_VERSION, APR_PATCH_VERSION,\r
105                 APU_MAJOR_VERSION, APU_MINOR_VERSION, APU_PATCH_VERSION);\r
106         SetDlgItemText(IDC_VERSIONABOUT, temp);\r
107         this->SetWindowText(_T("TortoiseMerge"));\r
108 \r
109         CPictureHolder tmpPic;\r
110         tmpPic.CreateFromBitmap(IDB_LOGOFLIPPED);\r
111         m_renderSrc.Create32BitFromPicture(&tmpPic,468,64);\r
112         m_renderDest.Create32BitFromPicture(&tmpPic,468,64);\r
113 \r
114         m_waterEffect.Create(468,64);\r
115         SetTimer(ID_EFFECTTIMER, 40, NULL);\r
116         SetTimer(ID_DROPTIMER, 300, NULL);\r
117 \r
118         m_cWebLink.SetURL(_T("http://tortoisesvn.net"));\r
119         m_cSupportLink.SetURL(_T("http://tortoisesvn.tigris.org/contributors.html"));\r
120 #endif\r
121         return TRUE;  // return TRUE unless you set the focus to a control\r
122         // EXCEPTION: OCX Property Pages should return FALSE\r
123 }\r
124 \r
125 void CAboutDlg::OnTimer(UINT_PTR nIDEvent)\r
126 {\r
127         if (nIDEvent == ID_EFFECTTIMER)\r
128         {\r
129                 m_waterEffect.Render((DWORD*)m_renderSrc.GetDIBits(), (DWORD*)m_renderDest.GetDIBits());\r
130                 CClientDC dc(this);\r
131                 CPoint ptOrigin(15,20);\r
132                 m_renderDest.Draw(&dc,ptOrigin);\r
133         }\r
134         if (nIDEvent == ID_DROPTIMER)\r
135         {\r
136                 CRect r;\r
137                 r.left = 15;\r
138                 r.top = 20;\r
139                 r.right = r.left + m_renderSrc.GetWidth();\r
140                 r.bottom = r.top + m_renderSrc.GetHeight();\r
141                 m_waterEffect.Blob(random(r.left,r.right), random(r.top, r.bottom), 2, 400, m_waterEffect.m_iHpage);\r
142         }\r
143         CDialog::OnTimer(nIDEvent);\r
144 }\r
145 \r
146 void CAboutDlg::OnMouseMove(UINT nFlags, CPoint point)\r
147 {\r
148         CRect r;\r
149         r.left = 15;\r
150         r.top = 20;\r
151         r.right = r.left + m_renderSrc.GetWidth();\r
152         r.bottom = r.top + m_renderSrc.GetHeight();\r
153 \r
154         if(r.PtInRect(point) == TRUE)\r
155         {\r
156                 // dibs are drawn upside down...\r
157                 point.y -= 20;\r
158                 point.y = 64-point.y;\r
159 \r
160                 if (nFlags & MK_LBUTTON)\r
161                         m_waterEffect.Blob(point.x -15,point.y,5,1600,m_waterEffect.m_iHpage);\r
162                 else\r
163                         m_waterEffect.Blob(point.x -15,point.y,2,50,m_waterEffect.m_iHpage);\r
164 \r
165         }\r
166 \r
167 \r
168         CDialog::OnMouseMove(nFlags, point);\r
169 }\r