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 "RevisionRangeDlg.h"
\r
24 IMPLEMENT_DYNAMIC(CRevisionRangeDlg, CStandAloneDialog)
\r
26 CRevisionRangeDlg::CRevisionRangeDlg(CWnd* pParent /*=NULL*/)
\r
27 : CStandAloneDialog(CRevisionRangeDlg::IDD, pParent)
\r
28 , m_bAllowWCRevs(true)
\r
29 , m_StartRev(_T("HEAD"))
\r
30 , m_EndRev(_T("HEAD"))
\r
34 CRevisionRangeDlg::~CRevisionRangeDlg()
\r
38 void CRevisionRangeDlg::DoDataExchange(CDataExchange* pDX)
\r
40 CStandAloneDialog::DoDataExchange(pDX);
\r
41 DDX_Text(pDX, IDC_REVNUM, m_sStartRevision);
\r
42 DDX_Text(pDX, IDC_REVNUM2, m_sEndRevision);
\r
46 BEGIN_MESSAGE_MAP(CRevisionRangeDlg, CStandAloneDialog)
\r
47 ON_EN_CHANGE(IDC_REVNUM, OnEnChangeRevnum)
\r
48 ON_EN_CHANGE(IDC_REVNUM2, OnEnChangeRevnum2)
\r
51 BOOL CRevisionRangeDlg::OnInitDialog()
\r
53 CStandAloneDialog::OnInitDialog();
\r
55 if (m_StartRev.IsHead())
\r
57 CheckRadioButton(IDC_NEWEST, IDC_REVISION_N, IDC_NEWEST);
\r
61 CheckRadioButton(IDC_NEWEST, IDC_REVISION_N, IDC_REVISION_N);
\r
63 if (m_StartRev.IsDate())
\r
64 sRev = m_StartRev.GetDateString();
\r
66 sRev.Format(_T("%ld"), (LONG)(m_StartRev));
\r
67 SetDlgItemText(IDC_REVNUM, sRev);
\r
69 if (m_EndRev.IsHead())
\r
71 CheckRadioButton(IDC_NEWEST2, IDC_REVISION_N2, IDC_NEWEST2);
\r
75 CheckRadioButton(IDC_NEWEST2, IDC_REVISION_N2, IDC_REVISION_N2);
\r
77 if (m_EndRev.IsDate())
\r
78 sRev = m_EndRev.GetDateString();
\r
80 sRev.Format(_T("%ld"), (LONG)(m_EndRev));
\r
81 SetDlgItemText(IDC_REVNUM2, sRev);
\r
84 if ((m_pParentWnd==NULL)&&(hWndExplorer))
\r
85 CenterWindow(CWnd::FromHandle(hWndExplorer));
\r
86 GetDlgItem(IDC_REVNUM)->SetFocus();
\r
90 void CRevisionRangeDlg::OnOK()
\r
92 if (!UpdateData(TRUE))
\r
93 return; // don't dismiss dialog (error message already shown by MFC framework)
\r
95 m_StartRev = SVNRev(m_sStartRevision);
\r
96 if (GetCheckedRadioButton(IDC_NEWEST, IDC_REVISION_N) == IDC_NEWEST)
\r
98 m_StartRev = SVNRev(_T("HEAD"));
\r
99 m_sStartRevision = _T("HEAD");
\r
101 if ((!m_StartRev.IsValid())||((!m_bAllowWCRevs)&&(m_StartRev.IsPrev() || m_StartRev.IsCommitted() || m_StartRev.IsBase())))
\r
103 ShowBalloon(IDC_REVNUM, m_bAllowWCRevs ? IDS_ERR_INVALIDREV : IDS_ERR_INVALIDREVNOWC);
\r
107 m_EndRev = SVNRev(m_sEndRevision);
\r
108 if (GetCheckedRadioButton(IDC_NEWEST2, IDC_REVISION_N2) == IDC_NEWEST2)
\r
110 m_EndRev = SVNRev(_T("HEAD"));
\r
111 m_sEndRevision = _T("HEAD");
\r
113 if ((!m_EndRev.IsValid())||((!m_bAllowWCRevs)&&(m_EndRev.IsPrev() || m_EndRev.IsCommitted() || m_EndRev.IsBase())))
\r
115 ShowBalloon(IDC_REVNUM2, m_bAllowWCRevs ? IDS_ERR_INVALIDREV : IDS_ERR_INVALIDREVNOWC);
\r
121 CStandAloneDialog::OnOK();
\r
124 void CRevisionRangeDlg::OnEnChangeRevnum()
\r
127 GetDlgItemText(IDC_REVNUM, sText);
\r
128 if (sText.IsEmpty())
\r
130 CheckRadioButton(IDC_NEWEST, IDC_REVISION_N, IDC_NEWEST);
\r
134 CheckRadioButton(IDC_NEWEST, IDC_REVISION_N, IDC_REVISION_N);
\r
138 void CRevisionRangeDlg::OnEnChangeRevnum2()
\r
141 GetDlgItemText(IDC_REVNUM2, sText);
\r
142 if (sText.IsEmpty())
\r
144 CheckRadioButton(IDC_NEWEST2, IDC_REVISION_N2, IDC_NEWEST2);
\r
148 CheckRadioButton(IDC_NEWEST2, IDC_REVISION_N2, IDC_REVISION_N2);
\r