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