1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2007-2008 - TortoiseSVN
\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
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
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
20 #include "TortoiseProc.h"
\r
21 #include "MergeWizard.h"
\r
26 IMPLEMENT_DYNAMIC(CMergeWizard, CPropertySheet)
\r
28 CMergeWizard::CMergeWizard(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
\r
29 :CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
\r
30 , bReverseMerge(FALSE)
\r
31 , nRevRangeMerge(MERGEWIZARD_REVRANGE)
\r
32 , m_bIgnoreAncestry(FALSE)
\r
33 , m_bIgnoreEOL(FALSE)
\r
34 , m_depth(svn_depth_unknown)
\r
35 , m_bRecordOnly(FALSE)
\r
36 , m_FirstPageActivation(true)
\r
43 AddPage(&reintegrate);
\r
45 m_psh.dwFlags |= PSH_WIZARD97|PSP_HASHELP|PSH_HEADER;
\r
46 m_psh.pszbmHeader = MAKEINTRESOURCE(IDB_MERGEWIZARDTITLE);
\r
48 m_psh.hInstance = AfxGetResourceHandle();
\r
49 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
\r
53 CMergeWizard::~CMergeWizard()
\r
58 BEGIN_MESSAGE_MAP(CMergeWizard, CPropertySheet)
\r
60 ON_WM_QUERYDRAGICON()
\r
64 // CMergeWizard message handlers
\r
66 BOOL CMergeWizard::OnInitDialog()
\r
68 BOOL bResult = CPropertySheet::OnInitDialog();
\r
70 SetIcon(m_hIcon, TRUE); // Set big icon
\r
71 SetIcon(m_hIcon, FALSE); // Set small icon
\r
74 url = svn.GetURLFromPath(wcPath);
\r
75 sUUID = svn.GetUUIDFromPath(wcPath);
\r
81 void CMergeWizard::SaveMode()
\r
83 CRegDWORD regMergeWizardMode(_T("Software\\TortoiseGit\\MergeWizardMode"), 0);
\r
84 if (DWORD(regMergeWizardMode))
\r
86 switch (nRevRangeMerge)
\r
88 case IDD_MERGEWIZARD_REVRANGE:
\r
89 regMergeWizardMode = 2;
\r
91 case IDD_MERGEWIZARD_REINTEGRATE:
\r
92 regMergeWizardMode = 3;
\r
94 case IDD_MERGEWIZARD_TREE:
\r
95 regMergeWizardMode = 1;
\r
98 regMergeWizardMode = 0;
\r
104 LRESULT CMergeWizard::GetSecondPage()
\r
106 switch (nRevRangeMerge)
\r
108 case MERGEWIZARD_REVRANGE:
\r
109 return IDD_MERGEWIZARD_REVRANGE;
\r
110 case MERGEWIZARD_TREE:
\r
111 return IDD_MERGEWIZARD_TREE;
\r
112 case MERGEWIZARD_REINTEGRATE:
\r
113 return IDD_MERGEWIZARD_REINTEGRATE;
\r
115 return IDD_MERGEWIZARD_REVRANGE;
\r
118 void CMergeWizard::OnPaint()
\r
122 CPaintDC dc(this); // device context for painting
\r
124 SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
\r
126 // Center icon in client rectangle
\r
127 int cxIcon = GetSystemMetrics(SM_CXICON);
\r
128 int cyIcon = GetSystemMetrics(SM_CYICON);
\r
130 GetClientRect(&rect);
\r
131 int x = (rect.Width() - cxIcon + 1) / 2;
\r
132 int y = (rect.Height() - cyIcon + 1) / 2;
\r
135 dc.DrawIcon(x, y, m_hIcon);
\r
139 CPropertySheet::OnPaint();
\r
143 HCURSOR CMergeWizard::OnQueryDragIcon()
\r
145 return static_cast<HCURSOR>(m_hIcon);
\r