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
23 * base class for the merge wizard property pages
\r
25 class CMergeWizardBasePage : public CPropertyPage
\r
28 CMergeWizardBasePage() : CPropertyPage() {;}
\r
29 explicit CMergeWizardBasePage(UINT nIDTemplate, UINT nIDCaption = 0, DWORD dwSize = sizeof(PROPSHEETPAGE))
\r
30 : CPropertyPage(nIDTemplate, nIDCaption, dwSize) {;}
\r
31 explicit CMergeWizardBasePage(LPCTSTR lpszTemplateName, UINT nIDCaption = 0, DWORD dwSize = sizeof(PROPSHEETPAGE))
\r
32 : CPropertyPage(lpszTemplateName, nIDCaption, dwSize) {;}
\r
34 virtual ~CMergeWizardBasePage() {;}
\r
39 virtual void SetButtonTexts()
\r
41 CPropertySheet* psheet = (CPropertySheet*) GetParent();
\r
44 psheet->GetDlgItem(ID_WIZFINISH)->SetWindowText(CString(MAKEINTRESOURCE(IDS_MERGE_MERGE)));
\r
45 psheet->GetDlgItem(ID_WIZBACK)->SetWindowText(CString(MAKEINTRESOURCE(IDS_PROPPAGE_BACK)));
\r
46 psheet->GetDlgItem(ID_WIZNEXT)->SetWindowText(CString(MAKEINTRESOURCE(IDS_PROPPAGE_NEXT)));
\r
47 psheet->GetDlgItem(IDHELP)->SetWindowText(CString(MAKEINTRESOURCE(IDS_PROPPAGE_HELP)));
\r
48 psheet->GetDlgItem(IDCANCEL)->SetWindowText(CString(MAKEINTRESOURCE(IDS_PROPPAGE_CANCEL)));
\r
52 void AdjustControlSize(UINT nID)
\r
54 CWnd * pwndDlgItem = GetDlgItem(nID);
\r
55 // adjust the size of the control to fit its content
\r
56 CString sControlText;
\r
57 pwndDlgItem->GetWindowText(sControlText);
\r
58 // next step: find the rectangle the control text needs to
\r
61 CDC * pDC = pwndDlgItem->GetWindowDC();
\r
63 RECT controlrectorig;
\r
64 pwndDlgItem->GetWindowRect(&controlrect);
\r
65 ::MapWindowPoints(NULL, GetSafeHwnd(), (LPPOINT)&controlrect, 2);
\r
66 controlrectorig = controlrect;
\r
69 CFont * font = pwndDlgItem->GetFont();
\r
70 CFont * pOldFont = pDC->SelectObject(font);
\r
71 if (pDC->DrawText(sControlText, -1, &controlrect, DT_WORDBREAK | DT_EDITCONTROL | DT_EXPANDTABS | DT_LEFT | DT_CALCRECT))
\r
73 // now we have the rectangle the control really needs
\r
74 if ((controlrectorig.right - controlrectorig.left) > (controlrect.right - controlrect.left))
\r
76 // we're dealing with radio buttons and check boxes,
\r
77 // which means we have to add a little space for the checkbox
\r
78 controlrectorig.right = controlrectorig.left + (controlrect.right - controlrect.left) + 20;
\r
79 pwndDlgItem->MoveWindow(&controlrectorig);
\r
82 pDC->SelectObject(pOldFont);
\r