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