1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2009-2012, 2014-2017 - 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.
19 // DeleteConflictDlg.cpp : implementation file
24 #include "DeleteConflictDlg.h"
28 // CDeleteConflictDlg dialog
30 IMPLEMENT_DYNAMIC(CDeleteConflictDlg
, CStandAloneDialog
)
32 CDeleteConflictDlg::CDeleteConflictDlg(CWnd
* pParent
/*=nullptr*/)
33 : CStandAloneDialog(CDeleteConflictDlg::IDD
, pParent
)
34 , m_bShowModifiedButton(FALSE
)
40 CDeleteConflictDlg::~CDeleteConflictDlg()
44 void CDeleteConflictDlg::DoDataExchange(CDataExchange
* pDX
)
46 CDialog::DoDataExchange(pDX
);
48 DDX_Text(pDX
, IDC_LOCAL_STATUS
, m_LocalStatus
);
49 DDX_Text(pDX
, IDC_REMOTE_STATUS
, m_RemoteStatus
);
50 DDX_Text(pDX
, IDC_FROMHASH
, m_LocalHash
);
51 DDX_Text(pDX
, IDC_TOHASH
, m_RemoteHash
);
55 BEGIN_MESSAGE_MAP(CDeleteConflictDlg
, CStandAloneDialog
)
56 ON_BN_CLICKED(IDC_LOG
, OnBnClickedLog
)
57 ON_BN_CLICKED(IDC_LOG2
, OnBnClickedLog2
)
58 ON_BN_CLICKED(IDC_DELETE
, &CDeleteConflictDlg::OnBnClickedDelete
)
59 ON_BN_CLICKED(IDC_MODIFY
, &CDeleteConflictDlg::OnBnClickedModify
)
60 ON_BN_CLICKED(IDHELP
, &OnHelp
)
61 ON_BN_CLICKED(IDC_SHOWDIFF
, &CDeleteConflictDlg::OnBnClickedShowdiff
)
62 ON_BN_CLICKED(IDC_SHOWDIFF2
, &CDeleteConflictDlg::OnBnClickedShowdiff
)
66 BOOL
CDeleteConflictDlg::OnInitDialog()
68 CStandAloneDialog::OnInitDialog();
70 if(this->m_bShowModifiedButton
)
72 this->GetDlgItem(IDC_MODIFY
)->SetWindowText(CString(MAKEINTRESOURCE(IDS_SVNACTION_MODIFIED
)));
74 GetDlgItem(IDC_SHOWDIFF
)->ShowWindow(SW_SHOW
);
76 GetDlgItem(IDC_SHOWDIFF2
)->ShowWindow(SW_SHOW
);
79 this->GetDlgItem(IDC_MODIFY
)->SetWindowText(CString(MAKEINTRESOURCE(IDS_PROC_CREATED
)));
80 if (m_LocalHash
.IsEmpty())
81 GetDlgItem(IDC_LOG
)->ShowWindow(SW_HIDE
);
82 if (m_RemoteHash
.IsEmpty())
83 GetDlgItem(IDC_LOG2
)->ShowWindow(SW_HIDE
);
86 GetWindowText(sWindowTitle
);
87 CAppUtils::SetWindowTitle(m_hWnd
, g_Git
.CombinePath(m_File
), sWindowTitle
);
89 GetDlgItem(IDC_INFOLABEL
)->SetWindowText(m_File
.GetGitPathString());
91 GetDlgItem(IDCANCEL
)->SetFocus();
95 // CDeleteConflictDlg message handlers
97 void CDeleteConflictDlg::OnBnClickedLog()
102 void CDeleteConflictDlg::OnBnClickedLog2()
104 ShowLog(m_RemoteHash
);
107 void CDeleteConflictDlg::OnBnClickedDelete()
113 void CDeleteConflictDlg::OnBnClickedModify()
119 void CDeleteConflictDlg::ShowLog(CString hash
)
122 sCmd
.Format(L
"/command:log /path:\"%s\" /endrev:%s", (LPCTSTR
)g_Git
.CombinePath(m_File
), (LPCTSTR
)hash
);
123 CAppUtils::RunTortoiseGitProc(sCmd
, false, false);
126 void CDeleteConflictDlg::OnBnClickedShowdiff()
129 base
.LoadString(IDS_PROC_DIFF_BASE
);
130 CAppUtils::DiffFlags flags
;
131 flags
.bAlternativeTool
= !!(GetAsyncKeyState(VK_SHIFT
) & 0x8000);
132 CAppUtils::StartExtDiff(m_FileBaseVersion
.GetWinPathString(), g_Git
.CombinePath(m_File
),
134 m_bDiffMine
? m_LocalHash
: m_RemoteHash
,
135 m_FileBaseVersion
.GetWinPathString(),
136 g_Git
.CombinePath(m_File
),
137 m_bDiffMine
? m_LocalHash
: m_RemoteHash
,
138 m_bDiffMine
? m_RemoteHash
: m_LocalHash
,