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 "RevisionDlg.h"
\r
22 #include "Balloon.h"
\r
25 IMPLEMENT_DYNAMIC(CRevisionDlg, CDialog)
\r
26 CRevisionDlg::CRevisionDlg(CWnd* pParent /*=NULL*/)
\r
27 : CDialog(CRevisionDlg::IDD, pParent)
\r
28 //, GitRev(_T("HEAD"))
\r
29 , m_bAllowWCRevs(true)
\r
33 CRevisionDlg::~CRevisionDlg()
\r
37 void CRevisionDlg::DoDataExchange(CDataExchange* pDX)
\r
39 CDialog::DoDataExchange(pDX);
\r
40 DDX_Text(pDX, IDC_REVNUM, m_sRevision);
\r
44 BEGIN_MESSAGE_MAP(CRevisionDlg, CDialog)
\r
45 ON_EN_CHANGE(IDC_REVNUM, OnEnChangeRevnum)
\r
48 BOOL CRevisionDlg::OnInitDialog()
\r
50 CDialog::OnInitDialog();
\r
54 CheckRadioButton(IDC_NEWEST, IDC_REVISION_N, IDC_NEWEST);
\r
58 CheckRadioButton(IDC_NEWEST, IDC_REVISION_N, IDC_REVISION_N);
\r
61 sRev = GetDateString();
\r
63 sRev.Format(_T("%ld"), (LONG)(*this));
\r
64 SetDlgItemText(IDC_REVNUM, sRev);
\r
66 if ((m_pParentWnd==NULL)&&(hWndExplorer))
\r
67 CenterWindow(CWnd::FromHandle(hWndExplorer));
\r
68 GetDlgItem(IDC_REVNUM)->SetFocus();
\r
72 void CRevisionDlg::OnOK()
\r
74 if (!UpdateData(TRUE))
\r
75 return; // don't dismiss dialog (error message already shown by MFC framework)
\r
77 SVNRev::Create(m_sRevision);
\r
78 // if head revision, set revision as -1
\r
79 if (GetCheckedRadioButton(IDC_NEWEST, IDC_REVISION_N) == IDC_NEWEST)
\r
81 SVNRev::Create(_T("HEAD"));
\r
82 m_sRevision = _T("HEAD");
\r
84 if ((!IsValid())||((!m_bAllowWCRevs)&&(IsPrev() || IsCommitted() || IsBase())))
\r
86 CBalloon::ShowBalloon(
\r
87 this, CBalloon::GetCtrlCentre(this, IDC_REVNUM),
\r
88 m_bAllowWCRevs ? IDS_ERR_INVALIDREV : IDS_ERR_INVALIDREVNOWC, TRUE, IDI_EXCLAMATION);
\r
97 void CRevisionDlg::OnEnChangeRevnum()
\r
100 GetDlgItemText(IDC_REVNUM, sText);
\r
101 if (sText.IsEmpty())
\r
103 CheckRadioButton(IDC_NEWEST, IDC_REVISION_N, IDC_NEWEST);
\r
107 CheckRadioButton(IDC_NEWEST, IDC_REVISION_N, IDC_REVISION_N);
\r