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