Update diff del rename ignore document.
[TortoiseGit.git] / src / TortoiseProc / RevisionRangeDlg.cpp
blob1779fea67c613d0fe66cfc5cd945c68bca0ede6e
1 // TortoiseSVN - a Windows shell extension for easy version control
3 // Copyright (C) 2003-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.
19 #include "stdafx.h"
20 #include "TortoiseProc.h"
21 #include "RevisionRangeDlg.h"
24 IMPLEMENT_DYNAMIC(CRevisionRangeDlg, CStandAloneDialog)
26 CRevisionRangeDlg::CRevisionRangeDlg(CWnd* pParent /*=NULL*/)
27 : CStandAloneDialog(CRevisionRangeDlg::IDD, pParent)
28 , m_bAllowWCRevs(true)
29 , m_StartRev(_T("HEAD"))
30 , m_EndRev(_T("HEAD"))
34 CRevisionRangeDlg::~CRevisionRangeDlg()
38 void CRevisionRangeDlg::DoDataExchange(CDataExchange* pDX)
40 CStandAloneDialog::DoDataExchange(pDX);
41 DDX_Text(pDX, IDC_REVNUM, m_sStartRevision);
42 DDX_Text(pDX, IDC_REVNUM2, m_sEndRevision);
46 BEGIN_MESSAGE_MAP(CRevisionRangeDlg, CStandAloneDialog)
47 ON_EN_CHANGE(IDC_REVNUM, OnEnChangeRevnum)
48 ON_EN_CHANGE(IDC_REVNUM2, OnEnChangeRevnum2)
49 END_MESSAGE_MAP()
51 BOOL CRevisionRangeDlg::OnInitDialog()
53 CStandAloneDialog::OnInitDialog();
55 if (m_StartRev.IsHead())
57 CheckRadioButton(IDC_NEWEST, IDC_REVISION_N, IDC_NEWEST);
59 else
61 CheckRadioButton(IDC_NEWEST, IDC_REVISION_N, IDC_REVISION_N);
62 CString sRev;
63 if (m_StartRev.IsDate())
64 sRev = m_StartRev.GetDateString();
65 else
66 sRev.Format(_T("%ld"), (LONG)(m_StartRev));
67 SetDlgItemText(IDC_REVNUM, sRev);
69 if (m_EndRev.IsHead())
71 CheckRadioButton(IDC_NEWEST2, IDC_REVISION_N2, IDC_NEWEST2);
73 else
75 CheckRadioButton(IDC_NEWEST2, IDC_REVISION_N2, IDC_REVISION_N2);
76 CString sRev;
77 if (m_EndRev.IsDate())
78 sRev = m_EndRev.GetDateString();
79 else
80 sRev.Format(_T("%ld"), (LONG)(m_EndRev));
81 SetDlgItemText(IDC_REVNUM2, sRev);
84 if ((m_pParentWnd==NULL)&&(hWndExplorer))
85 CenterWindow(CWnd::FromHandle(hWndExplorer));
86 GetDlgItem(IDC_REVNUM)->SetFocus();
87 return FALSE;
90 void CRevisionRangeDlg::OnOK()
92 if (!UpdateData(TRUE))
93 return; // don't dismiss dialog (error message already shown by MFC framework)
95 m_StartRev = SVNRev(m_sStartRevision);
96 if (GetCheckedRadioButton(IDC_NEWEST, IDC_REVISION_N) == IDC_NEWEST)
98 m_StartRev = SVNRev(_T("HEAD"));
99 m_sStartRevision = _T("HEAD");
101 if ((!m_StartRev.IsValid())||((!m_bAllowWCRevs)&&(m_StartRev.IsPrev() || m_StartRev.IsCommitted() || m_StartRev.IsBase())))
103 ShowBalloon(IDC_REVNUM, m_bAllowWCRevs ? IDS_ERR_INVALIDREV : IDS_ERR_INVALIDREVNOWC);
104 return;
107 m_EndRev = SVNRev(m_sEndRevision);
108 if (GetCheckedRadioButton(IDC_NEWEST2, IDC_REVISION_N2) == IDC_NEWEST2)
110 m_EndRev = SVNRev(_T("HEAD"));
111 m_sEndRevision = _T("HEAD");
113 if ((!m_EndRev.IsValid())||((!m_bAllowWCRevs)&&(m_EndRev.IsPrev() || m_EndRev.IsCommitted() || m_EndRev.IsBase())))
115 ShowBalloon(IDC_REVNUM2, m_bAllowWCRevs ? IDS_ERR_INVALIDREV : IDS_ERR_INVALIDREVNOWC);
116 return;
119 UpdateData(FALSE);
121 CStandAloneDialog::OnOK();
124 void CRevisionRangeDlg::OnEnChangeRevnum()
126 CString sText;
127 GetDlgItemText(IDC_REVNUM, sText);
128 if (sText.IsEmpty())
130 CheckRadioButton(IDC_NEWEST, IDC_REVISION_N, IDC_NEWEST);
132 else
134 CheckRadioButton(IDC_NEWEST, IDC_REVISION_N, IDC_REVISION_N);
138 void CRevisionRangeDlg::OnEnChangeRevnum2()
140 CString sText;
141 GetDlgItemText(IDC_REVNUM2, sText);
142 if (sText.IsEmpty())
144 CheckRadioButton(IDC_NEWEST2, IDC_REVISION_N2, IDC_NEWEST2);
146 else
148 CheckRadioButton(IDC_NEWEST2, IDC_REVISION_N2, IDC_REVISION_N2);