1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2012 - TortoiseGit
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"
22 #include "SubmoduleDiffDlg.h"
24 IMPLEMENT_DYNAMIC(CSubmoduleDiffDlg
, CHorizontalResizableStandAloneDialog
)
25 CSubmoduleDiffDlg::CSubmoduleDiffDlg(CWnd
* pParent
/*=NULL*/)
26 : CHorizontalResizableStandAloneDialog(CSubmoduleDiffDlg::IDD
, pParent
)
30 CSubmoduleDiffDlg::~CSubmoduleDiffDlg()
34 void CSubmoduleDiffDlg::DoDataExchange(CDataExchange
* pDX
)
36 CHorizontalResizableStandAloneDialog::DoDataExchange(pDX
);
37 DDX_Text(pDX
, IDC_FROMHASH
, m_sFromHash
);
38 DDX_Text(pDX
, IDC_FROMSUBJECT
, m_sFromSubject
);
39 DDX_Text(pDX
, IDC_TOHASH
, m_sToHash
);
40 DDX_Text(pDX
, IDC_TOSUBJECT
, m_sToSubject
);
43 BEGIN_MESSAGE_MAP(CSubmoduleDiffDlg
, CHorizontalResizableStandAloneDialog
)
44 ON_BN_CLICKED(IDC_LOG
, &CSubmoduleDiffDlg::OnBnClickedLog
)
45 ON_BN_CLICKED(IDC_LOG2
, &CSubmoduleDiffDlg::OnBnClickedLog2
)
48 BOOL
CSubmoduleDiffDlg::OnInitDialog()
50 CHorizontalResizableStandAloneDialog::OnInitDialog();
53 GetWindowText(sWindowTitle
);
54 CAppUtils::SetWindowTitle(m_hWnd
, g_Git
.m_CurrentDir
, sWindowTitle
);
56 AddAnchor(IDC_FROMGROUP
, TOP_LEFT
, TOP_RIGHT
);
57 AddAnchor(IDC_TOGROUP
, TOP_LEFT
, TOP_RIGHT
);
59 AddAnchor(IDC_LOG
, TOP_LEFT
);
60 AddAnchor(IDC_LOG2
, TOP_LEFT
);
62 AddAnchor(IDC_FROMHASH
, TOP_LEFT
, TOP_RIGHT
);
63 AddAnchor(IDC_FROMSUBJECT
, TOP_LEFT
, TOP_RIGHT
);
64 AddAnchor(IDC_TOHASH
, TOP_LEFT
, TOP_RIGHT
);
65 AddAnchor(IDC_TOSUBJECT
, TOP_LEFT
, TOP_RIGHT
);
67 EnableSaveRestore(_T("SubmoduleDiffDlg"));
69 if (m_bToIsWorkingCopy
)
72 GetDlgItem(IDC_TOGROUP
)->GetWindowText(toGroup
);
73 toGroup
+= _T(" (") + CString(MAKEINTRESOURCE(IDS_git_DEPTH_WORKING
)) + _T(")");
74 GetDlgItem(IDC_TOGROUP
)->SetWindowText(toGroup
);
77 CString title
= _T("Submodule \"") + m_sPath
+ _T("\"");
78 GetDlgItem(IDC_SUBMODULEDIFFTITLE
)->SetWindowText(title
);
85 void CSubmoduleDiffDlg::SetDiff(CString path
, bool toIsWorkingCopy
, CString fromHash
, CString fromSubject
, CString toHash
, CString toSubject
)
87 m_bToIsWorkingCopy
= toIsWorkingCopy
;
91 m_sFromHash
= fromHash
;
92 m_sFromSubject
= fromSubject
;
94 m_sToSubject
= toSubject
;
97 void CSubmoduleDiffDlg::ShowLog(CString hash
)
100 sCmd
.Format(_T("/command:log /path:\"%s\" /rev:%s"), g_Git
.m_CurrentDir
+ _T("\\") + m_sPath
, hash
);
101 CAppUtils::RunTortoiseProc(sCmd
);
104 void CSubmoduleDiffDlg::OnBnClickedLog()
106 ShowLog(m_sFromHash
);
109 void CSubmoduleDiffDlg::OnBnClickedLog2()