1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2003-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 "MessageBox.h"
\r
22 #include "TGitPath.h"
\r
23 #include "RenameDlg.h"
\r
24 #include ".\renamedlg.h"
\r
25 #include "CommonResource.h"
\r
27 IMPLEMENT_DYNAMIC(CRenameDlg, CResizableStandAloneDialog)
\r
28 CRenameDlg::CRenameDlg(CWnd* pParent /*=NULL*/)
\r
29 : CResizableStandAloneDialog(CRenameDlg::IDD, pParent)
\r
34 CRenameDlg::~CRenameDlg()
\r
38 void CRenameDlg::DoDataExchange(CDataExchange* pDX)
\r
40 CResizableStandAloneDialog::DoDataExchange(pDX);
\r
41 DDX_Text(pDX, IDC_NAME, m_name);
\r
45 BEGIN_MESSAGE_MAP(CRenameDlg, CResizableStandAloneDialog)
\r
47 ON_EN_CHANGE(IDC_NAME, OnEnChangeName)
\r
50 BOOL CRenameDlg::OnInitDialog()
\r
52 CResizableStandAloneDialog::OnInitDialog();
\r
54 SHAutoComplete(GetDlgItem(IDC_NAME)->m_hWnd, SHACF_DEFAULT);
\r
56 if (!m_windowtitle.IsEmpty())
\r
57 this->SetWindowText(m_windowtitle);
\r
58 if (!m_label.IsEmpty())
\r
59 SetDlgItemText(IDC_LABEL, m_label);
\r
60 AddAnchor(IDC_LABEL, TOP_LEFT);
\r
61 AddAnchor(IDC_NAME, TOP_LEFT, TOP_RIGHT);
\r
62 AddAnchor(IDOK, BOTTOM_RIGHT);
\r
63 AddAnchor(IDCANCEL, BOTTOM_RIGHT);
\r
65 CenterWindow(CWnd::FromHandle(hWndExplorer));
\r
66 EnableSaveRestore(_T("RenameDlg"));
\r
67 GetDlgItem(IDOK)->EnableWindow(FALSE);
\r
71 void CRenameDlg::OnOK()
\r
75 CTGitPath path(m_name);
\r
76 if (!path.IsValidOnWindows())
\r
78 if (CMessageBox::Show(GetSafeHwnd(), IDS_WARN_NOVALIDPATH, IDS_APPNAME, MB_ICONWARNING | MB_OKCANCEL)==IDCANCEL)
\r
81 CResizableDialog::OnOK();
\r
84 void CRenameDlg::OnSizing(UINT fwSide, LPRECT pRect)
\r
86 // don't allow the dialog to be changed in height
\r
88 GetWindowRect(&rcWindowRect);
\r
92 case WMSZ_BOTTOMLEFT:
\r
93 case WMSZ_BOTTOMRIGHT:
\r
94 pRect->bottom = pRect->top + rcWindowRect.Height();
\r
99 pRect->top = pRect->bottom - rcWindowRect.Height();
\r
102 CResizableStandAloneDialog::OnSizing(fwSide, pRect);
\r
105 void CRenameDlg::OnEnChangeName()
\r
108 GetDlgItem(IDOK)->EnableWindow(!m_name.IsEmpty());
\r