OSDN Git Service

add spell check
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / MergeWizard.cpp
1 // TortoiseSVN - a Windows shell extension for easy version control\r
2 \r
3 // Copyright (C) 2007-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 #include "stdafx.h"\r
20 #include "TortoiseProc.h"\r
21 #include "MergeWizard.h"\r
22 \r
23 \r
24 // CMergeWizard\r
25 \r
26 IMPLEMENT_DYNAMIC(CMergeWizard, CPropertySheet)\r
27 \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
37 {\r
38         SetWizardMode();\r
39         AddPage(&page1);\r
40         AddPage(&tree);\r
41         AddPage(&revrange);\r
42         AddPage(&options);\r
43         AddPage(&reintegrate);\r
44 \r
45         m_psh.dwFlags |= PSH_WIZARD97|PSP_HASHELP|PSH_HEADER;\r
46         m_psh.pszbmHeader = MAKEINTRESOURCE(IDB_MERGEWIZARDTITLE);\r
47 \r
48         m_psh.hInstance = AfxGetResourceHandle();\r
49         m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);\r
50 }\r
51 \r
52 \r
53 CMergeWizard::~CMergeWizard()\r
54 {\r
55 }\r
56 \r
57 \r
58 BEGIN_MESSAGE_MAP(CMergeWizard, CPropertySheet)\r
59         ON_WM_PAINT()\r
60         ON_WM_QUERYDRAGICON()\r
61 END_MESSAGE_MAP()\r
62 \r
63 \r
64 // CMergeWizard message handlers\r
65 \r
66 BOOL CMergeWizard::OnInitDialog()\r
67 {\r
68         BOOL bResult = CPropertySheet::OnInitDialog();\r
69 \r
70         SetIcon(m_hIcon, TRUE);                 // Set big icon\r
71         SetIcon(m_hIcon, FALSE);                // Set small icon\r
72 \r
73         SVN svn;\r
74         url = svn.GetURLFromPath(wcPath);\r
75         sUUID = svn.GetUUIDFromPath(wcPath);\r
76 \r
77         return bResult;\r
78 }\r
79 \r
80 \r
81 void CMergeWizard::SaveMode()\r
82 {\r
83         CRegDWORD regMergeWizardMode(_T("Software\\TortoiseSVN\\MergeWizardMode"), 0);\r
84         if (DWORD(regMergeWizardMode))\r
85         {\r
86                 switch (nRevRangeMerge)\r
87                 {\r
88                 case IDD_MERGEWIZARD_REVRANGE:\r
89                         regMergeWizardMode = 2;\r
90                         break;\r
91                 case IDD_MERGEWIZARD_REINTEGRATE:\r
92                         regMergeWizardMode = 3;\r
93                         break;\r
94                 case IDD_MERGEWIZARD_TREE:\r
95                         regMergeWizardMode = 1;\r
96                         break;\r
97                 default:\r
98                         regMergeWizardMode = 0;\r
99                         break;\r
100                 }\r
101         }\r
102 }\r
103 \r
104 LRESULT CMergeWizard::GetSecondPage()\r
105 {\r
106         switch (nRevRangeMerge)\r
107         {\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
114         }\r
115         return IDD_MERGEWIZARD_REVRANGE;\r
116 }\r
117 \r
118 void CMergeWizard::OnPaint()\r
119 {\r
120         if (IsIconic())\r
121         {\r
122                 CPaintDC dc(this); // device context for painting\r
123 \r
124                 SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);\r
125 \r
126                 // Center icon in client rectangle\r
127                 int cxIcon = GetSystemMetrics(SM_CXICON);\r
128                 int cyIcon = GetSystemMetrics(SM_CYICON);\r
129                 CRect rect;\r
130                 GetClientRect(&rect);\r
131                 int x = (rect.Width() - cxIcon + 1) / 2;\r
132                 int y = (rect.Height() - cyIcon + 1) / 2;\r
133 \r
134                 // Draw the icon\r
135                 dc.DrawIcon(x, y, m_hIcon);\r
136         }\r
137         else\r
138         {\r
139                 CPropertySheet::OnPaint();\r
140         }\r
141 }\r
142 \r
143 HCURSOR CMergeWizard::OnQueryDragIcon()\r
144 {\r
145         return static_cast<HCURSOR>(m_hIcon);\r
146 }\r