From 9a7c943fa273810c5795813adfd369ebd62c7385 Mon Sep 17 00:00:00 2001 From: Sup Yut Sum Date: Sun, 10 Mar 2013 11:34:31 +0800 Subject: [PATCH] Open the explorer with the converted temp file selected on a Ctrl+trippleclick on the view header, helps with debugging Based on TortoiseSVN revision 23981 Signed-off-by: Sup Yut Sum --- src/TortoiseMerge/BaseView.cpp | 13 ++++++++++++- src/TortoiseMerge/BaseView.h | 3 ++- src/TortoiseMerge/DiffData.cpp | 5 ++++- src/TortoiseMerge/MainFrm.cpp | 5 +++++ src/TortoiseMerge/WorkingFile.h | 5 ++++- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/TortoiseMerge/BaseView.cpp b/src/TortoiseMerge/BaseView.cpp index b060181aa..637a5ccc1 100644 --- a/src/TortoiseMerge/BaseView.cpp +++ b/src/TortoiseMerge/BaseView.cpp @@ -3097,8 +3097,19 @@ void CBaseView::OnLButtonDblClk(UINT nFlags, CPoint point) void CBaseView::OnLButtonTrippleClick( UINT /*nFlags*/, CPoint point ) { const int nClickedLine = GetButtonEventLineIndex(point); - if (nClickedLine < 0) + if (((point.y - HEADERHEIGHT) / GetLineHeight()) <= 0) + { + if (!m_sConvertedFilePath.IsEmpty() && (GetKeyState(VK_CONTROL)&0x8000)) + { + PCIDLIST_ABSOLUTE __unaligned pidl = ILCreateFromPath((LPCTSTR)m_sConvertedFilePath); + if (pidl) + { + SHOpenFolderAndSelectItems(pidl,0,0,0); + CoTaskMemFree((LPVOID)pidl); + } + } return; + } POINT ptCaretPos; ptCaretPos.y = nClickedLine; ptCaretPos.x = CalculateCharIndex(ptCaretPos.y, m_nOffsetChar + (point.x - GetMarginWidth()) / GetCharWidth()); diff --git a/src/TortoiseMerge/BaseView.h b/src/TortoiseMerge/BaseView.h index d1ce6b34a..4a784de32 100644 --- a/src/TortoiseMerge/BaseView.h +++ b/src/TortoiseMerge/BaseView.h @@ -1,6 +1,6 @@ // TortoiseGitMerge - a Diff/Patch program -// Copyright (C) 2003-2012 - TortoiseSVN +// Copyright (C) 2003-2013 - TortoiseSVN // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -206,6 +206,7 @@ public: // variables CString m_sWindowName; ///< The name of the view which is shown as a window title to the user CString m_sFullFilePath; ///< The full path of the file shown + CString m_sConvertedFilePath; ///< the path to the converted file that's shown in the view CFileTextLines::UnicodeType texttype; ///< the text encoding this view uses EOL lineendings; ///< the line endings the view uses diff --git a/src/TortoiseMerge/DiffData.cpp b/src/TortoiseMerge/DiffData.cpp index c196d69fa..7d2cb5146 100644 --- a/src/TortoiseMerge/DiffData.cpp +++ b/src/TortoiseMerge/DiffData.cpp @@ -1,6 +1,6 @@ // TortoiseGitMerge - a Diff/Patch program -// Copyright (C) 2006-2012 - TortoiseSVN +// Copyright (C) 2006-2013 - TortoiseSVN // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -276,18 +276,21 @@ BOOL CDiffData::Load() if (bBaseNeedConvert) { sConvertedBaseFilename = CTempFiles::Instance().GetTempFilePathString(); + m_baseFile.SetConvertedFileName(sConvertedBaseFilename); m_arBaseFile.Save(sConvertedBaseFilename, true, true, 0, bIgnoreCase, m_bBlame); } bYourNeedConvert |= (IsYourFileInUse() && !bYourIsUtf8 && bIsUtf8); if (bYourNeedConvert) { sConvertedYourFilename = CTempFiles::Instance().GetTempFilePathString(); + m_yourFile.SetConvertedFileName(sConvertedYourFilename); m_arYourFile.Save(sConvertedYourFilename, true, true, 0, bIgnoreCase, m_bBlame); } bTheirNeedConvert |= (IsTheirFileInUse() && !bTheirIsUtf8 && bIsUtf8); if (bTheirNeedConvert) { sConvertedTheirFilename = CTempFiles::Instance().GetTempFilePathString(); + m_theirFile.SetConvertedFileName(sConvertedTheirFilename); m_arTheirFile.Save(sConvertedTheirFilename, true, true, 0, bIgnoreCase, m_bBlame); } diff --git a/src/TortoiseMerge/MainFrm.cpp b/src/TortoiseMerge/MainFrm.cpp index ca943cd07..ed94f32b6 100644 --- a/src/TortoiseMerge/MainFrm.cpp +++ b/src/TortoiseMerge/MainFrm.cpp @@ -755,12 +755,14 @@ bool CMainFrame::LoadViews(int line) m_pwndLeftView->lineendings = m_Data.m_arBaseFile.GetLineEndings(); m_pwndLeftView->m_sWindowName = m_Data.m_baseFile.GetWindowName(); m_pwndLeftView->m_sFullFilePath = m_Data.m_baseFile.GetFilename(); + m_pwndLeftView->m_sConvertedFilePath = m_Data.m_baseFile.GetConvertedFileName(); m_pwndRightView->m_pViewData = &m_Data.m_YourBaseRight; m_pwndRightView->texttype = m_Data.m_arYourFile.GetUnicodeType(); m_pwndRightView->lineendings = m_Data.m_arYourFile.GetLineEndings(); m_pwndRightView->m_sWindowName = m_Data.m_yourFile.GetWindowName(); m_pwndRightView->m_sFullFilePath = m_Data.m_yourFile.GetFilename(); + m_pwndRightView->m_sConvertedFilePath = m_Data.m_yourFile.GetConvertedFileName(); m_pwndBottomView->m_pViewData = NULL; @@ -784,6 +786,7 @@ bool CMainFrame::LoadViews(int line) m_pwndLeftView->m_sWindowName.LoadString(IDS_VIEWTITLE_THEIRS); m_pwndLeftView->m_sWindowName += _T(" - ") + m_Data.m_theirFile.GetWindowName(); m_pwndLeftView->m_sFullFilePath = m_Data.m_theirFile.GetFilename(); + m_pwndLeftView->m_sConvertedFilePath = m_Data.m_theirFile.GetConvertedFileName(); m_pwndRightView->m_pViewData = &m_Data.m_YourBaseBoth; m_pwndRightView->texttype = m_Data.m_arYourFile.GetUnicodeType(); @@ -791,6 +794,7 @@ bool CMainFrame::LoadViews(int line) m_pwndRightView->m_sWindowName.LoadString(IDS_VIEWTITLE_MINE); m_pwndRightView->m_sWindowName += _T(" - ") + m_Data.m_yourFile.GetWindowName(); m_pwndRightView->m_sFullFilePath = m_Data.m_yourFile.GetFilename(); + m_pwndRightView->m_sConvertedFilePath = m_Data.m_yourFile.GetConvertedFileName(); m_pwndBottomView->m_pViewData = &m_Data.m_Diff3; m_pwndBottomView->texttype = m_Data.m_arTheirFile.GetUnicodeType(); @@ -798,6 +802,7 @@ bool CMainFrame::LoadViews(int line) m_pwndBottomView->m_sWindowName.LoadString(IDS_VIEWTITLE_MERGED); m_pwndBottomView->m_sWindowName += _T(" - ") + m_Data.m_mergedFile.GetWindowName(); m_pwndBottomView->m_sFullFilePath = m_Data.m_mergedFile.GetFilename(); + m_pwndBottomView->m_sConvertedFilePath = m_Data.m_mergedFile.GetConvertedFileName(); if (m_wndSplitter2.IsColumnHidden(1)) m_wndSplitter2.ShowColumn(); diff --git a/src/TortoiseMerge/WorkingFile.h b/src/TortoiseMerge/WorkingFile.h index 6a17ca13d..589a621b0 100644 --- a/src/TortoiseMerge/WorkingFile.h +++ b/src/TortoiseMerge/WorkingFile.h @@ -1,6 +1,6 @@ // TortoiseGitMerge - a Diff/Patch program -// Copyright (C) 2006-2007, 2011 - TortoiseSVN +// Copyright (C) 2006-2007, 2011, 2013 - TortoiseSVN // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -34,6 +34,8 @@ public: bool InUse() const { return !m_sFilename.IsEmpty(); } bool Exists() const; void SetFileName(const CString& newFilename); + void SetConvertedFileName(const CString& newName) { m_sConvertedFilename = newName; } + CString GetConvertedFileName() const { return m_sConvertedFilename; } void SetDescriptiveName(const CString& newDescName); CString GetDescriptiveName(); void CreateEmptyFile(); @@ -52,6 +54,7 @@ private: void ClearStoredAttributes(); CString m_sFilename; + CString m_sConvertedFilename; CString m_sDescriptiveName; WIN32_FILE_ATTRIBUTE_DATA m_attribs; }; -- 2.11.4.GIT