Add Miss file
[TortoiseGit.git] / src / TortoiseMerge / AboutDlg.cpp
blob617f251837818c09f410a4f56a9b1e57d17dc5e8
1 // TortoiseMerge - a Diff/Patch program
3 // Copyright (C) 2006-2007 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include "stdafx.h"
20 #include "TortoiseMerge.h"
21 #include "AboutDlg.h"
22 #include "svn_version.h"
23 #include "svn_diff.h"
24 #include "..\..\\apr\include\apr_version.h"
25 #include "..\..\apr-util\include\apu_version.h"
26 #include "..\version.h"
28 // CAboutDlg dialog
30 IMPLEMENT_DYNAMIC(CAboutDlg, CDialog)
31 CAboutDlg::CAboutDlg(CWnd* pParent /*=NULL*/)
32 : CDialog(CAboutDlg::IDD, pParent)
34 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
37 CAboutDlg::~CAboutDlg()
41 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
43 CDialog::DoDataExchange(pDX);
44 DDX_Control(pDX, IDC_WEBLINK, m_cWebLink);
45 DDX_Control(pDX, IDC_SUPPORTLINK, m_cSupportLink);
49 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
50 ON_WM_PAINT()
51 ON_WM_QUERYDRAGICON()
52 ON_WM_TIMER()
53 ON_WM_MOUSEMOVE()
54 END_MESSAGE_MAP()
57 void CAboutDlg::OnPaint()
59 if (IsIconic())
61 CPaintDC dc(this); // device context for painting
63 SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
65 // Center icon in client rectangle
66 int cxIcon = GetSystemMetrics(SM_CXICON);
67 int cyIcon = GetSystemMetrics(SM_CYICON);
68 CRect rect;
69 GetClientRect(&rect);
70 int x = (rect.Width() - cxIcon + 1) / 2;
71 int y = (rect.Height() - cyIcon + 1) / 2;
73 // Draw the icon
74 dc.DrawIcon(x, y, m_hIcon);
76 else
78 CDialog::OnPaint();
82 // The system calls this function to obtain the cursor to display while the user drags
83 // the minimized window.
84 HCURSOR CAboutDlg::OnQueryDragIcon()
86 return static_cast<HCURSOR>(m_hIcon);
89 BOOL CAboutDlg::OnInitDialog()
91 CDialog::OnInitDialog();
92 // Set the icon for this dialog. The framework does this automatically
93 // when the application's main window is not a dialog
94 SetIcon(m_hIcon, TRUE); // Set big icon
95 SetIcon(m_hIcon, FALSE); // Set small icon
97 //set the version string
98 CString temp, boxtitle;
99 boxtitle.Format(IDS_ABOUTVERSIONBOX, TSVN_VERMAJOR, TSVN_VERMINOR, TSVN_VERMICRO, TSVN_VERBUILD, _T(TSVN_PLATFORM), _T(TSVN_VERDATE));
100 SetDlgItemText(IDC_VERSIONBOX, boxtitle);
101 const svn_version_t * diffver = svn_diff_version();
102 temp.Format(IDS_ABOUTVERSION, TSVN_VERMAJOR, TSVN_VERMINOR, TSVN_VERMICRO, TSVN_VERBUILD, _T(TSVN_PLATFORM), _T(TSVN_VERDATE),
103 diffver->major, diffver->minor, diffver->patch, CString(diffver->tag),
104 APR_MAJOR_VERSION, APR_MINOR_VERSION, APR_PATCH_VERSION,
105 APU_MAJOR_VERSION, APU_MINOR_VERSION, APU_PATCH_VERSION);
106 SetDlgItemText(IDC_VERSIONABOUT, temp);
107 this->SetWindowText(_T("TortoiseMerge"));
109 CPictureHolder tmpPic;
110 tmpPic.CreateFromBitmap(IDB_LOGOFLIPPED);
111 m_renderSrc.Create32BitFromPicture(&tmpPic,468,64);
112 m_renderDest.Create32BitFromPicture(&tmpPic,468,64);
114 m_waterEffect.Create(468,64);
115 SetTimer(ID_EFFECTTIMER, 40, NULL);
116 SetTimer(ID_DROPTIMER, 300, NULL);
118 m_cWebLink.SetURL(_T("http://tortoisesvn.net"));
119 m_cSupportLink.SetURL(_T("http://tortoisesvn.tigris.org/contributors.html"));
121 return TRUE; // return TRUE unless you set the focus to a control
122 // EXCEPTION: OCX Property Pages should return FALSE
125 void CAboutDlg::OnTimer(UINT_PTR nIDEvent)
127 if (nIDEvent == ID_EFFECTTIMER)
129 m_waterEffect.Render((DWORD*)m_renderSrc.GetDIBits(), (DWORD*)m_renderDest.GetDIBits());
130 CClientDC dc(this);
131 CPoint ptOrigin(15,20);
132 m_renderDest.Draw(&dc,ptOrigin);
134 if (nIDEvent == ID_DROPTIMER)
136 CRect r;
137 r.left = 15;
138 r.top = 20;
139 r.right = r.left + m_renderSrc.GetWidth();
140 r.bottom = r.top + m_renderSrc.GetHeight();
141 m_waterEffect.Blob(random(r.left,r.right), random(r.top, r.bottom), 2, 400, m_waterEffect.m_iHpage);
143 CDialog::OnTimer(nIDEvent);
146 void CAboutDlg::OnMouseMove(UINT nFlags, CPoint point)
148 CRect r;
149 r.left = 15;
150 r.top = 20;
151 r.right = r.left + m_renderSrc.GetWidth();
152 r.bottom = r.top + m_renderSrc.GetHeight();
154 if(r.PtInRect(point) == TRUE)
156 // dibs are drawn upside down...
157 point.y -= 20;
158 point.y = 64-point.y;
160 if (nFlags & MK_LBUTTON)
161 m_waterEffect.Blob(point.x -15,point.y,5,1600,m_waterEffect.m_iHpage);
162 else
163 m_waterEffect.Blob(point.x -15,point.y,2,50,m_waterEffect.m_iHpage);
168 CDialog::OnMouseMove(nFlags, point);