1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2003-2007 - 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 "UpdateDlg.h"
\r
22 #include "registry.h"
\r
25 IMPLEMENT_DYNAMIC(CUpdateDlg, CStandAloneDialog)
\r
26 CUpdateDlg::CUpdateDlg(CWnd* pParent /*=NULL*/)
\r
27 : CStandAloneDialog(CUpdateDlg::IDD, pParent)
\r
28 , Revision(_T("HEAD"))
\r
29 , m_bNoExternals(FALSE)
\r
34 CUpdateDlg::~CUpdateDlg()
\r
40 void CUpdateDlg::DoDataExchange(CDataExchange* pDX)
\r
42 CStandAloneDialog::DoDataExchange(pDX);
\r
43 DDX_Text(pDX, IDC_REVNUM, m_sRevision);
\r
44 DDX_Check(pDX, IDC_NOEXTERNALS, m_bNoExternals);
\r
45 DDX_Control(pDX, IDC_DEPTH, m_depthCombo);
\r
49 BEGIN_MESSAGE_MAP(CUpdateDlg, CStandAloneDialog)
\r
50 ON_BN_CLICKED(IDC_LOG, OnBnClickedShowLog)
\r
51 ON_REGISTERED_MESSAGE(WM_REVSELECTED, OnRevSelected)
\r
52 ON_EN_CHANGE(IDC_REVNUM, &CUpdateDlg::OnEnChangeRevnum)
\r
55 BOOL CUpdateDlg::OnInitDialog()
\r
57 CStandAloneDialog::OnInitDialog();
\r
59 AdjustControlSize(IDC_NEWEST);
\r
60 AdjustControlSize(IDC_REVISION_N);
\r
61 AdjustControlSize(IDC_NOEXTERNALS);
\r
63 m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_WORKING)));
\r
64 m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_INFINITE)));
\r
65 m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_IMMEDIATE)));
\r
66 m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_FILES)));
\r
67 m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_EMPTY)));
\r
68 m_depthCombo.SetCurSel(0);
\r
70 CheckRadioButton(IDC_NEWEST, IDC_REVISION_N, IDC_NEWEST);
\r
71 GetDlgItem(IDC_REVNUM)->SetFocus();
\r
72 if ((m_pParentWnd==NULL)&&(hWndExplorer))
\r
73 CenterWindow(CWnd::FromHandle(hWndExplorer));
\r
77 void CUpdateDlg::OnOK()
\r
79 if (!UpdateData(TRUE))
\r
80 return; // don't dismiss dialog (error message already shown by MFC framework)
\r
82 Revision = SVNRev(m_sRevision);
\r
83 if (GetCheckedRadioButton(IDC_NEWEST, IDC_REVISION_N) == IDC_NEWEST)
\r
85 Revision = SVNRev(_T("HEAD"));
\r
87 if (!Revision.IsValid())
\r
89 ShowBalloon(IDC_REVNUM, IDS_ERR_INVALIDREV);
\r
92 switch (m_depthCombo.GetCurSel())
\r
95 m_depth = svn_depth_unknown;
\r
98 m_depth = svn_depth_infinity;
\r
101 m_depth = svn_depth_immediates;
\r
104 m_depth = svn_depth_files;
\r
107 m_depth = svn_depth_empty;
\r
110 m_depth = svn_depth_empty;
\r
116 CStandAloneDialog::OnOK();
\r
119 void CUpdateDlg::OnBnClickedShowLog()
\r
122 if (::IsWindow(m_pLogDlg->GetSafeHwnd())&&(m_pLogDlg->IsWindowVisible()))
\r
124 if (!m_wcPath.IsEmpty())
\r
127 m_pLogDlg = new CLogDlg();
\r
128 CRegDWORD reg = CRegDWORD(_T("Software\\TortoiseGit\\NumberOfLogs"), 100);
\r
129 int limit = (int)(LONG)reg;
\r
130 m_pLogDlg->SetSelect(true);
\r
131 m_pLogDlg->m_pNotifyWindow = this;
\r
132 m_pLogDlg->m_wParam = 0;
\r
133 m_pLogDlg->SetParams(m_wcPath, SVNRev::REV_HEAD, SVNRev::REV_HEAD, 1, limit, TRUE);
\r
134 m_pLogDlg->ContinuousSelection(true);
\r
135 m_pLogDlg->Create(IDD_LOGMESSAGE, this);
\r
136 m_pLogDlg->ShowWindow(SW_SHOW);
\r
138 AfxGetApp()->DoWaitCursor(-1);
\r
141 LPARAM CUpdateDlg::OnRevSelected(WPARAM /*wParam*/, LPARAM lParam)
\r
144 temp.Format(_T("%ld"), lParam);
\r
145 SetDlgItemText(IDC_REVNUM, temp);
\r
146 CheckRadioButton(IDC_NEWEST, IDC_REVISION_N, IDC_REVISION_N);
\r
150 void CUpdateDlg::OnEnChangeRevnum()
\r
153 if (m_sRevision.IsEmpty())
\r
154 CheckRadioButton(IDC_NEWEST, IDC_REVISION_N, IDC_NEWEST);
\r
156 CheckRadioButton(IDC_NEWEST, IDC_REVISION_N, IDC_REVISION_N);
\r