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_SUBMODULEDIFFTITLE
, TOP_LEFT
, TOP_RIGHT
);
57 AddAnchor(IDC_STATIC_REVISION
, TOP_LEFT
);
58 AddAnchor(IDC_STATIC_REVISION2
, TOP_LEFT
);
59 AddAnchor(IDC_STATIC_SUBJECT
, TOP_LEFT
);
60 AddAnchor(IDC_STATIC_SUBJECT2
, TOP_LEFT
);
62 AddAnchor(IDC_FROMGROUP
, TOP_LEFT
, TOP_RIGHT
);
63 AddAnchor(IDC_TOGROUP
, TOP_LEFT
, TOP_RIGHT
);
65 AddAnchor(IDC_LOG
, TOP_RIGHT
);
66 AddAnchor(IDC_LOG2
, TOP_RIGHT
);
68 AddAnchor(IDC_FROMHASH
, TOP_LEFT
, TOP_RIGHT
);
69 AddAnchor(IDC_FROMSUBJECT
, TOP_LEFT
, TOP_RIGHT
);
70 AddAnchor(IDC_TOHASH
, TOP_LEFT
, TOP_RIGHT
);
71 AddAnchor(IDC_TOSUBJECT
, TOP_LEFT
, TOP_RIGHT
);
73 EnableSaveRestore(_T("SubmoduleDiffDlg"));
75 if (m_bToIsWorkingCopy
)
78 GetDlgItem(IDC_TOGROUP
)->GetWindowText(toGroup
);
79 toGroup
+= _T(" (") + CString(MAKEINTRESOURCE(IDS_git_DEPTH_WORKING
)) + _T(")");
80 GetDlgItem(IDC_TOGROUP
)->SetWindowText(toGroup
);
83 CString title
= _T("Submodule \"") + m_sPath
+ _T("\"");
84 GetDlgItem(IDC_SUBMODULEDIFFTITLE
)->SetWindowText(title
);
91 void CSubmoduleDiffDlg::SetDiff(CString path
, bool toIsWorkingCopy
, CString fromHash
, CString fromSubject
, CString toHash
, CString toSubject
)
93 m_bToIsWorkingCopy
= toIsWorkingCopy
;
97 m_sFromHash
= fromHash
;
98 m_sFromSubject
= fromSubject
;
100 m_sToSubject
= toSubject
;
103 void CSubmoduleDiffDlg::ShowLog(CString hash
)
106 sCmd
.Format(_T("/command:log /path:\"%s\" /endrev:%s"), g_Git
.m_CurrentDir
+ _T("\\") + m_sPath
, hash
);
107 CAppUtils::RunTortoiseProc(sCmd
);
110 void CSubmoduleDiffDlg::OnBnClickedLog()
112 ShowLog(m_sFromHash
);
115 void CSubmoduleDiffDlg::OnBnClickedLog2()