OSDN Git Service

Add LogList To GitBlame
authorFrank Li <lznuaa@gmail.com>
Sun, 11 Jan 2009 04:23:58 +0000 (12:23 +0800)
committerFrank Li <lznuaa@gmail.com>
Sun, 11 Jan 2009 04:23:58 +0000 (12:23 +0800)
12 files changed:
src/Resources/TortoiseGitBlame.rc [moved from src/TortoiseGitBlame/TortoiseGitBlame.rc with 96% similarity]
src/Resources/TortoiseGitBlame.rc2 [moved from src/TortoiseGitBlame/res/TortoiseGitBlame.rc2 with 70% similarity]
src/TortoiseGitBlame/GitBlameLogList.h [new file with mode: 0644]
src/TortoiseGitBlame/LogListBlameAction.cpp [new file with mode: 0644]
src/TortoiseGitBlame/TortoiseGitBlame.vcproj
src/TortoiseProc/GitLogList.h
src/TortoiseProc/GitLogListAction.cpp [new file with mode: 0644]
src/TortoiseProc/GitLogListBase.cpp [moved from src/TortoiseProc/GitLogList.cpp with 71% similarity]
src/TortoiseProc/GitLogListBase.h [new file with mode: 0644]
src/TortoiseProc/LogDataVector.cpp
src/TortoiseProc/LogDlgHelper.h
src/TortoiseProc/TortoiseProc.vcproj

similarity index 96%
rename from src/TortoiseGitBlame/TortoiseGitBlame.rc
rename to src/Resources/TortoiseGitBlame.rc
index d864aad..9bc44d5 100644 (file)
@@ -453,7 +453,7 @@ END
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r
 LANGUAGE 9, 1\r
 #pragma code_page(1252)\r
-#include "res\\TortoiseGitBlame.rc2"  // non-Microsoft Visual C++ edited resources\r
+#include "..\\Resources\\TortoiseGitBlame.rc2"  // non-Microsoft Visual C++ edited resources\r
 #include "afxres.rc"   // Standard components\r
 #include "afxprint.rc"  // printing/print preview resources\r
 #if !defined(_AFXDLL)\r
similarity index 70%
rename from src/TortoiseGitBlame/res/TortoiseGitBlame.rc2
rename to src/Resources/TortoiseGitBlame.rc2
index cf5c79b..ad97f6e 100644 (file)
@@ -11,3 +11,6 @@
 // Add manually edited resources here...\r
 \r
 /////////////////////////////////////////////////////////////////////////////\r
+#include "..\version.h"\r
+//#include "..\\TortoiseShell\\resourceshell.rc"\r
+/////////////////////////////////////////////////////////////////////////////\r
diff --git a/src/TortoiseGitBlame/GitBlameLogList.h b/src/TortoiseGitBlame/GitBlameLogList.h
new file mode 100644 (file)
index 0000000..3f768c7
--- /dev/null
@@ -0,0 +1,8 @@
+#pragma once\r
+#include "GitLoglistBase.h"\r
+class CGitBlameLogList : public CGitLogListBase\r
+{\r
+       DECLARE_DYNAMIC(CGitBlameLogList)\r
+public:\r
+       void ContextMenuAction(int cmd,int FirstSelect, int LastSelect);\r
+};
\ No newline at end of file
diff --git a/src/TortoiseGitBlame/LogListBlameAction.cpp b/src/TortoiseGitBlame/LogListBlameAction.cpp
new file mode 100644 (file)
index 0000000..74e9b69
--- /dev/null
@@ -0,0 +1,9 @@
+#include "stdafx.h"\r
+#include "GitBlameLogList.h"\r
+#include "GitRev.h"\r
+\r
+IMPLEMENT_DYNAMIC(CGitBlameLogList, CHintListCtrl)\r
+\r
+void CGitBlameLogList::ContextMenuAction(int cmd,int FirstSelect, int LastSelect)\r
+{      \r
+}
\ No newline at end of file
index 768e873..f4249bd 100644 (file)
@@ -45,7 +45,7 @@
                        <Tool\r
                                Name="VCCLCompilerTool"\r
                                Optimization="0"\r
-                               AdditionalIncludeDirectories="..\Git;..\TortoiseProc;..\..\ext\scintilla\include;..\Utils;..\Utils\MiscUI;..\..\ext\hunspell"\r
+                               AdditionalIncludeDirectories="..\Git;..\TortoiseProc;..\..\ext\scintilla\include;..\Utils;..\Utils\MiscUI;..\..\ext\hunspell;..\..\ext\ResizableLib"\r
                                PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"\r
                                MinimalRebuild="true"\r
                                BasicRuntimeChecks="3"\r
                                Name="VCCLCompilerTool"\r
                                Optimization="2"\r
                                EnableIntrinsicFunctions="true"\r
-                               AdditionalIncludeDirectories="..\Git;..\TortoiseProc;..\..\ext\scintilla\include;..\Utils;..\Utils\MiscUI;..\..\ext\hunspell"\r
+                               AdditionalIncludeDirectories="..\Git;..\TortoiseProc;..\..\ext\scintilla\include;..\Utils;..\Utils\MiscUI;..\..\ext\hunspell;..\..\ext\ResizableLib"\r
                                PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"\r
                                MinimalRebuild="false"\r
                                RuntimeLibrary="2"\r
                        UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
                        >\r
                        <File\r
+                               RelativePath=".\GitBlameLogList.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\TortoiseProc\GitLogListBase.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\TortoiseProc\GitLogListBase.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\TortoiseProc\lanes.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\TortoiseProc\lanes.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\TortoiseProc\LogDataVector.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\TortoiseProc\LogDlgHelper.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\TortoiseProc\LogDlgHelper.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\LogListBlameAction.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath=".\MainFrm.cpp"\r
                                >\r
                        </File>\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\TortoiseGitBlame.rc"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath=".\res\TortoiseGitBlame.rc2"\r
+                               RelativePath="..\Resources\TortoiseGitBlame.rc"\r
                                >\r
                        </File>\r
                        <File\r
index c49be27..cf35607 100644 (file)
 #pragma once\r
+#include "GitLoglistBase.h"\r
 \r
-#include "HintListCtrl.h"\r
-#include "XPTheme.h"\r
-#include "resource.h"\r
-#include "Git.h"\r
-#include "ProjectProperties.h"\r
-#include "StandAloneDlg.h"\r
-#include "TGitPath.h"\r
-#include "registry.h"\r
-#include "SplitterControl.h"\r
-#include "Colors.h"\r
-#include "MenuButton.h"\r
-#include "LogDlgHelper.h"\r
-#include "FilterEdit.h"\r
-#include "GitRev.h"\r
-#include "Tooltip.h"\r
-#include "HintListCtrl.h"\r
-#include "GitLogList.h"\r
-#include "lanes.h"\r
+class CGitLogListBase;\r
 \r
-#include <regex>\r
-// CGitLogList\r
-#if (NTDDI_VERSION < NTDDI_LONGHORN)\r
-\r
-enum LISTITEMSTATES_MINE {\r
-       LISS_NORMAL = 1,\r
-       LISS_HOT = 2,\r
-       LISS_SELECTED = 3,\r
-       LISS_DISABLED = 4,\r
-       LISS_SELECTEDNOTFOCUS = 5,\r
-       LISS_HOTSELECTED = 6,\r
-};\r
-\r
-#define MCS_NOTRAILINGDATES  0x0040\r
-#define MCS_SHORTDAYSOFWEEK  0x0080\r
-#define MCS_NOSELCHANGEONNAV 0x0100\r
-\r
-#define DTM_SETMCSTYLE    (DTM_FIRST + 11)\r
-\r
-#endif\r
-\r
-#define ICONITEMBORDER 5\r
-\r
-#define GITLOG_START 0\r
-#define GITLOG_START_ALL 1\r
-#define GITLOG_END   100\r
-\r
-#define LOGFILTER_ALL      1\r
-#define LOGFILTER_MESSAGES 2\r
-#define LOGFILTER_PATHS    3\r
-#define LOGFILTER_AUTHORS  4\r
-#define LOGFILTER_REVS    5\r
-#define LOGFILTER_REGEX           6\r
-#define LOGFILTER_BUGID    7\r
-\r
-typedef void CALLBACK_PROCESS(void * data, int progress);\r
-\r
-class CGitLogList : public CHintListCtrl\r
+class CGitLogList : public CGitLogListBase\r
 {\r
        DECLARE_DYNAMIC(CGitLogList)\r
-\r
 public:\r
-       CGitLogList();\r
-       virtual ~CGitLogList();\r
-       volatile LONG           m_bNoDispUpdates;\r
-       BOOL m_bStrictStopped;\r
-       BOOL m_bShowBugtraqColumn;\r
-       BOOL m_bSearchIndex;\r
-       BOOL m_bCancelled;\r
-       bool                            m_hasWC;\r
-       GitRev                          m_wcRev;\r
-       volatile LONG           m_bThreadRunning;\r
-\r
-       enum\r
-       {\r
-               LOGLIST_GRAPH,\r
-               LOGLIST_ACTION,\r
-               LOGLIST_MESSAGE,\r
-               LOGLIST_AUTHOR,\r
-               LOGLIST_DATE,\r
-               LOGLIST_BUG,\r
-               LOGLIST_MESSAGE_MAX=300,\r
-               LOGLIST_MESSAGE_MIN=200\r
-       };\r
-\r
-       enum \r
-       {\r
-       // needs to start with 1, since 0 is the return value if *nothing* is clicked on in the context menu\r
-       ID_COMPARE = 1,\r
-       ID_SAVEAS,\r
-       ID_COMPARETWO,\r
-       ID_UPDATE,\r
-       ID_COPY,\r
-       ID_REVERTREV,\r
-       ID_MERGEREV,\r
-       ID_GNUDIFF1,\r
-       ID_GNUDIFF2,\r
-       ID_FINDENTRY,\r
-       ID_OPEN,\r
-       ID_BLAME,\r
-       ID_REPOBROWSE,\r
-       ID_LOG,\r
-       ID_POPPROPS,\r
-       ID_EDITAUTHOR,\r
-       ID_EDITLOG,\r
-       ID_DIFF,\r
-       ID_OPENWITH,\r
-       ID_COPYCLIPBOARD,\r
-       ID_COPYHASH,\r
-       ID_CHECKOUT,\r
-       ID_REVERTTOREV,\r
-       ID_BLAMECOMPARE,\r
-       ID_BLAMETWO,\r
-       ID_BLAMEDIFF,\r
-       ID_VIEWREV,\r
-       ID_VIEWPATHREV,\r
-       ID_EXPORT,\r
-       ID_COMPAREWITHPREVIOUS,\r
-       ID_BLAMEWITHPREVIOUS,\r
-       ID_GETMERGELOGS,\r
-       ID_REVPROPS,\r
-       ID_CHERRY_PICK,\r
-       ID_CREATE_BRANCH,\r
-       ID_CREATE_TAG,\r
-       ID_SWITCHTOREV\r
-       };\r
-       void InsertGitColumn();\r
-       void ResizeAllListCtrlCols();\r
-       void CopySelectionToClipBoard(bool hashonly=FALSE);\r
-       void DiffSelectedRevWithPrevious();\r
-       bool IsSelectionContinuous();\r
-       int  FillGitShortLog();\r
-       inline int ShownCountWithStopped() const { return (int)m_arShownList.GetCount() + (m_bStrictStopped ? 1 : 0); }\r
-       int FetchLogAsync(CALLBACK_PROCESS *proc=NULL, void * data=NULL);\r
-       CPtrArray                       m_arShownList;\r
-       void Refresh();\r
-       void RecalculateShownList(CPtrArray * pShownlist);\r
-\r
-       int                                     m_nSelectedFilter;\r
-       CLogDataVector          m_logEntries;\r
-       void RemoveFilter();\r
-       void StartFilter();\r
-       bool ValidateRegexp(LPCTSTR regexp_str, tr1::wregex& pat, bool bMatchCase = false );\r
-       CString                         m_sFilterText;\r
-       CTime                   m_From;\r
-       CTime                   m_To;\r
-       void                            GetTimeRange(CTime &oldest,CTime &latest);\r
-protected:\r
-       DECLARE_MESSAGE_MAP()\r
-       afx_msg void OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult);\r
-       afx_msg void OnLvnGetdispinfoLoglist(NMHDR *pNMHDR, LRESULT *pResult);\r
-       afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);\r
-       afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);\r
-       void OnNMDblclkLoglist(NMHDR * /*pNMHDR*/, LRESULT *pResult);\r
-       afx_msg void OnLvnOdfinditemLoglist(NMHDR *pNMHDR, LRESULT *pResult);\r
-       void PreSubclassWindow();\r
-       virtual BOOL PreTranslateMessage(MSG* pMsg);\r
-       static UINT LogThreadEntry(LPVOID pVoid);\r
-       UINT LogThread();\r
-       void FillBackGround(HDC hdc, int Index,CRect &rect);\r
-       void DrawTagBranch(HDC,CRect &rect,INT_PTR index);\r
-       void DrawGraph(HDC,CRect &rect,INT_PTR index);\r
-\r
-       BOOL GetShortName(CString ref, CString &shortname,CString prefix);\r
-       void paintGraphLane(HDC hdc,int laneHeight, int type, int x1, int x2,\r
-                                      const COLORREF& col,int top) ; \r
-       void DrawLine(HDC hdc, int x1, int y1, int x2, int y2){::MoveToEx(hdc,x1,y1,NULL);::LineTo(hdc,x2,y2);}\r
-\r
-\r
-       BOOL IsEntryInDateRange(int i);\r
-\r
-\r
-\r
-       bool                            m_bFilterWithRegex;\r
-\r
-       \r
-       CXPTheme                        m_Theme;\r
-       BOOL                            m_bVista;\r
-       \r
-       HICON                           m_hModifiedIcon;\r
-       HICON                           m_hReplacedIcon;\r
-       HICON                           m_hAddedIcon;\r
-       HICON                           m_hDeletedIcon;\r
-\r
-       HFONT                           m_boldFont;\r
-\r
-       CRegDWORD                       m_regMaxBugIDColWidth;\r
-       int                                     m_nSearchIndex;\r
-       \r
-       CALLBACK_PROCESS    *m_ProcCallBack;\r
-       void                            *m_ProcData;\r
-       CStoreSelection*        m_pStoreSelection;\r
-       MAP_HASH_NAME           m_HashMap;\r
-};\r
-\r
-\r
+       void ContextMenuAction(int cmd,int FirstSelect, int LastSelect);\r
+};
\ No newline at end of file
diff --git a/src/TortoiseProc/GitLogListAction.cpp b/src/TortoiseProc/GitLogListAction.cpp
new file mode 100644 (file)
index 0000000..5f5f6fa
--- /dev/null
@@ -0,0 +1,504 @@
+// GitLogList.cpp : implementation file\r
+//\r
+/*\r
+       Description: qgit revision list view\r
+\r
+       Author: Marco Costalba (C) 2005-2007\r
+\r
+       Copyright: See COPYING file that comes with this distribution\r
+\r
+*/\r
+#include "stdafx.h"\r
+#include "TortoiseProc.h"\r
+#include "GitLogList.h"\r
+#include "GitRev.h"\r
+//#include "VssStyle.h"\r
+#include "IconMenu.h"\r
+// CGitLogList\r
+#include "cursor.h"\r
+#include "InputDlg.h"\r
+#include "PropDlg.h"\r
+#include "SVNProgressDlg.h"\r
+#include "ProgressDlg.h"\r
+//#include "RepositoryBrowser.h"\r
+//#include "CopyDlg.h"\r
+//#include "StatGraphDlg.h"\r
+#include "Logdlg.h"\r
+#include "MessageBox.h"\r
+#include "Registry.h"\r
+#include "AppUtils.h"\r
+#include "PathUtils.h"\r
+#include "StringUtils.h"\r
+#include "UnicodeUtils.h"\r
+#include "TempFile.h"\r
+//#include "GitInfo.h"\r
+//#include "GitDiff.h"\r
+#include "IconMenu.h"\r
+//#include "RevisionRangeDlg.h"\r
+//#include "BrowseFolder.h"\r
+//#include "BlameDlg.h"\r
+//#include "Blame.h"\r
+//#include "GitHelpers.h"\r
+#include "GitStatus.h"\r
+//#include "LogDlgHelper.h"\r
+//#include "CachedLogInfo.h"\r
+//#include "RepositoryInfo.h"\r
+//#include "EditPropertiesDlg.h"\r
+#include "FileDiffDlg.h"\r
+\r
+IMPLEMENT_DYNAMIC(CGitLogList, CHintListCtrl)\r
+\r
+void CGitLogList::ContextMenuAction(int cmd,int FirstSelect, int LastSelect)\r
+{      \r
+       POSITION pos = GetFirstSelectedItemPosition();\r
+       int indexNext = GetNextSelectedItem(pos);\r
+       if (indexNext < 0)\r
+               return;\r
+\r
+       GitRev* pSelLogEntry = reinterpret_cast<GitRev*>(m_arShownList.GetAt(indexNext));\r
+\r
+       theApp.DoWaitCursor(1);\r
+       bool bOpenWith = false;\r
+\r
+       switch (cmd)\r
+               {\r
+                       case ID_GNUDIFF1:\r
+                       {\r
+                               CString tempfile=GetTempFile();\r
+                               CString cmd;\r
+                               GitRev * r1 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(FirstSelect));\r
+                               cmd.Format(_T("git.exe diff-tree -r -p --stat %s"),r1->m_CommitHash);\r
+                               g_Git.RunLogFile(cmd,tempfile);\r
+                               CAppUtils::StartUnifiedDiffViewer(tempfile,r1->m_CommitHash.Left(6)+_T(":")+r1->m_Subject);\r
+                       }\r
+                       break;\r
+\r
+                       case ID_GNUDIFF2:\r
+                       {\r
+                               CString tempfile=GetTempFile();\r
+                               CString cmd;\r
+                               GitRev * r1 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(FirstSelect));\r
+                               GitRev * r2 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(LastSelect));\r
+                               cmd.Format(_T("git.exe diff-tree -r -p --stat %s %s"),r1->m_CommitHash,r2->m_CommitHash);\r
+                               g_Git.RunLogFile(cmd,tempfile);\r
+                               CAppUtils::StartUnifiedDiffViewer(tempfile,r1->m_CommitHash.Left(6)+_T(":")+r2->m_CommitHash.Left(6));\r
+\r
+                       }\r
+                       break;\r
+\r
+               case ID_COMPARETWO:\r
+                       {\r
+                               GitRev * r1 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(FirstSelect));\r
+                               GitRev * r2 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(LastSelect));\r
+                               CFileDiffDlg dlg;\r
+                               dlg.SetDiff(NULL,*r1,*r2);\r
+                               dlg.DoModal();\r
+                               \r
+                       }\r
+                       break;\r
+               \r
+\r
+               case ID_COMPARE:\r
+                       {\r
+                               GitRev * r1 = &m_wcRev;\r
+                               GitRev * r2 = pSelLogEntry;\r
+                               CFileDiffDlg dlg;\r
+                               dlg.SetDiff(NULL,*r1,*r2);\r
+                               dlg.DoModal();\r
+\r
+                               //user clicked on the menu item "compare with working copy"\r
+                               //if (PromptShown())\r
+                               //{\r
+                               //      GitDiff diff(this, m_hWnd, true);\r
+                               //      diff.SetAlternativeTool(!!(GetAsyncKeyState(VK_SHIFT) & 0x8000));\r
+                               //      diff.SetHEADPeg(m_LogRevision);\r
+                               //      diff.ShowCompare(m_path, GitRev::REV_WC, m_path, revSelected);\r
+                               //}\r
+                               //else\r
+                               //      CAppUtils::StartShowCompare(m_hWnd, m_path, GitRev::REV_WC, m_path, revSelected, GitRev(), m_LogRevision, !!(GetAsyncKeyState(VK_SHIFT) & 0x8000));\r
+                       }\r
+                       break;\r
+\r
+               case ID_COMPAREWITHPREVIOUS:\r
+                       {\r
+\r
+                               CFileDiffDlg dlg;\r
+                               \r
+                               if(pSelLogEntry->m_ParentHash.size()>0)\r
+                               //if(m_logEntries.m_HashMap[pSelLogEntry->m_ParentHash[0]]>=0)\r
+                               {\r
+                                       dlg.SetDiff(NULL,pSelLogEntry->m_CommitHash,pSelLogEntry->m_ParentHash[0]);\r
+                                       dlg.DoModal();\r
+                               }else\r
+                               {\r
+                                       CMessageBox::Show(NULL,_T("No previous version"),_T("TortoiseGit"),MB_OK);      \r
+                               }\r
+                               //if (PromptShown())\r
+                               //{\r
+                               //      GitDiff diff(this, m_hWnd, true);\r
+                               //      diff.SetAlternativeTool(!!(GetAsyncKeyState(VK_SHIFT) & 0x8000));\r
+                               //      diff.SetHEADPeg(m_LogRevision);\r
+                               //      diff.ShowCompare(CTGitPath(pathURL), revPrevious, CTGitPath(pathURL), revSelected);\r
+                               //}\r
+                               //else\r
+                               //      CAppUtils::StartShowCompare(m_hWnd, CTGitPath(pathURL), revPrevious, CTGitPath(pathURL), revSelected, GitRev(), m_LogRevision, !!(GetAsyncKeyState(VK_SHIFT) & 0x8000));\r
+                       }\r
+                       break;\r
+               case ID_COPYCLIPBOARD:\r
+                       {\r
+                               CopySelectionToClipBoard();\r
+                       }\r
+                       break;\r
+               case ID_COPYHASH:\r
+                       {\r
+                               CopySelectionToClipBoard(TRUE);\r
+                       }\r
+                       break;\r
+               case ID_EXPORT:\r
+                       CAppUtils::Export(&pSelLogEntry->m_CommitHash);\r
+                       break;\r
+               case ID_CREATE_BRANCH:\r
+                       CAppUtils::CreateBranchTag(FALSE,&pSelLogEntry->m_CommitHash);\r
+                       m_HashMap.clear();\r
+                       g_Git.GetMapHashToFriendName(m_HashMap);\r
+                       Invalidate();                   \r
+                       break;\r
+               case ID_CREATE_TAG:\r
+                       CAppUtils::CreateBranchTag(TRUE,&pSelLogEntry->m_CommitHash);\r
+                       m_HashMap.clear();\r
+                       g_Git.GetMapHashToFriendName(m_HashMap);\r
+                       Invalidate();\r
+                       break;\r
+               case ID_SWITCHTOREV:\r
+                       CAppUtils::Switch(&pSelLogEntry->m_CommitHash);\r
+                       m_HashMap.clear();\r
+                       g_Git.GetMapHashToFriendName(m_HashMap);\r
+                       Invalidate();\r
+                       break;\r
+\r
+               default:\r
+                       //CMessageBox::Show(NULL,_T("Have not implemented"),_T("TortoiseGit"),MB_OK);\r
+                       break;\r
+#if 0\r
+       \r
+               case ID_REVERTREV:\r
+                       {\r
+                               // we need an URL to complete this command, so error out if we can't get an URL\r
+                               if (pathURL.IsEmpty())\r
+                               {\r
+                                       CString strMessage;\r
+                                       strMessage.Format(IDS_ERR_NOURLOFFILE, (LPCTSTR)(m_path.GetUIPathString()));\r
+                                       CMessageBox::Show(this->m_hWnd, strMessage, _T("TortoiseGit"), MB_ICONERROR);\r
+                                       TRACE(_T("could not retrieve the URL of the folder!\n"));\r
+                                       break;          //exit\r
+                               }\r
+                               CString msg;\r
+                               msg.Format(IDS_LOG_REVERT_CONFIRM, m_path.GetWinPath());\r
+                               if (CMessageBox::Show(this->m_hWnd, msg, _T("TortoiseGit"), MB_YESNO | MB_ICONQUESTION) == IDYES)\r
+                               {\r
+                                       CGitProgressDlg dlg;\r
+                                       dlg.SetCommand(CGitProgressDlg::GitProgress_Merge);\r
+                                       dlg.SetPathList(CTGitPathList(m_path));\r
+                                       dlg.SetUrl(pathURL);\r
+                                       dlg.SetSecondUrl(pathURL);\r
+                                       revisionRanges.AdjustForMerge(true);\r
+                                       dlg.SetRevisionRanges(revisionRanges);\r
+                                       dlg.SetPegRevision(m_LogRevision);\r
+                                       dlg.DoModal();\r
+                               }\r
+                       }\r
+                       break;\r
+               case ID_MERGEREV:\r
+                       {\r
+                               // we need an URL to complete this command, so error out if we can't get an URL\r
+                               if (pathURL.IsEmpty())\r
+                               {\r
+                                       CString strMessage;\r
+                                       strMessage.Format(IDS_ERR_NOURLOFFILE, (LPCTSTR)(m_path.GetUIPathString()));\r
+                                       CMessageBox::Show(this->m_hWnd, strMessage, _T("TortoiseGit"), MB_ICONERROR);\r
+                                       TRACE(_T("could not retrieve the URL of the folder!\n"));\r
+                                       break;          //exit\r
+                               }\r
+\r
+                               CString path = m_path.GetWinPathString();\r
+                               bool bGotSavePath = false;\r
+                               if ((GetSelectedCount() == 1)&&(!m_path.IsDirectory()))\r
+                               {\r
+                                       bGotSavePath = CAppUtils::FileOpenSave(path, NULL, IDS_LOG_MERGETO, IDS_COMMONFILEFILTER, true, GetSafeHwnd());\r
+                               }\r
+                               else\r
+                               {\r
+                                       CBrowseFolder folderBrowser;\r
+                                       folderBrowser.SetInfo(CString(MAKEINTRESOURCE(IDS_LOG_MERGETO)));\r
+                                       bGotSavePath = (folderBrowser.Show(GetSafeHwnd(), path, path) == CBrowseFolder::OK);\r
+                               }\r
+                               if (bGotSavePath)\r
+                               {\r
+                                       CGitProgressDlg dlg;\r
+                                       dlg.SetCommand(CGitProgressDlg::GitProgress_Merge);\r
+                                       dlg.SetPathList(CTGitPathList(CTGitPath(path)));\r
+                                       dlg.SetUrl(pathURL);\r
+                                       dlg.SetSecondUrl(pathURL);\r
+                                       revisionRanges.AdjustForMerge(false);\r
+                                       dlg.SetRevisionRanges(revisionRanges);\r
+                                       dlg.SetPegRevision(m_LogRevision);\r
+                                       dlg.DoModal();\r
+                               }\r
+                       }\r
+                       break;\r
+               case ID_REVERTTOREV:\r
+                       {\r
+                               // we need an URL to complete this command, so error out if we can't get an URL\r
+                               if (pathURL.IsEmpty())\r
+                               {\r
+                                       CString strMessage;\r
+                                       strMessage.Format(IDS_ERR_NOURLOFFILE, (LPCTSTR)(m_path.GetUIPathString()));\r
+                                       CMessageBox::Show(this->m_hWnd, strMessage, _T("TortoiseGit"), MB_ICONERROR);\r
+                                       TRACE(_T("could not retrieve the URL of the folder!\n"));\r
+                                       break;          //exit\r
+                               }\r
+\r
+                               CString msg;\r
+                               msg.Format(IDS_LOG_REVERTTOREV_CONFIRM, m_path.GetWinPath());\r
+                               if (CMessageBox::Show(this->m_hWnd, msg, _T("TortoiseGit"), MB_YESNO | MB_ICONQUESTION) == IDYES)\r
+                               {\r
+                                       CGitProgressDlg dlg;\r
+                                       dlg.SetCommand(CGitProgressDlg::GitProgress_Merge);\r
+                                       dlg.SetPathList(CTGitPathList(m_path));\r
+                                       dlg.SetUrl(pathURL);\r
+                                       dlg.SetSecondUrl(pathURL);\r
+                                       GitRevRangeArray revarray;\r
+                                       revarray.AddRevRange(GitRev::REV_HEAD, revSelected);\r
+                                       dlg.SetRevisionRanges(revarray);\r
+                                       dlg.SetPegRevision(m_LogRevision);\r
+                                       dlg.DoModal();\r
+                               }\r
+                       }\r
+                       break;\r
+       \r
+\r
+       \r
+               case ID_BLAMECOMPARE:\r
+                       {\r
+                               //user clicked on the menu item "compare with working copy"\r
+                               //now first get the revision which is selected\r
+                               if (PromptShown())\r
+                               {\r
+                                       GitDiff diff(this, this->m_hWnd, true);\r
+                                       diff.SetHEADPeg(m_LogRevision);\r
+                                       diff.ShowCompare(m_path, GitRev::REV_BASE, m_path, revSelected, GitRev(), false, true);\r
+                               }\r
+                               else\r
+                                       CAppUtils::StartShowCompare(m_hWnd, m_path, GitRev::REV_BASE, m_path, revSelected, GitRev(), m_LogRevision, false, false, true);\r
+                       }\r
+                       break;\r
+               case ID_BLAMETWO:\r
+                       {\r
+                               //user clicked on the menu item "compare and blame revisions"\r
+                               if (PromptShown())\r
+                               {\r
+                                       GitDiff diff(this, this->m_hWnd, true);\r
+                                       diff.SetHEADPeg(m_LogRevision);\r
+                                       diff.ShowCompare(CTGitPath(pathURL), revSelected2, CTGitPath(pathURL), revSelected, GitRev(), false, true);\r
+                               }\r
+                               else\r
+                                       CAppUtils::StartShowCompare(m_hWnd, CTGitPath(pathURL), revSelected2, CTGitPath(pathURL), revSelected, GitRev(), m_LogRevision, false, false, true);\r
+                       }\r
+                       break;\r
+               case ID_BLAMEWITHPREVIOUS:\r
+                       {\r
+                               //user clicked on the menu item "Compare and Blame with previous revision"\r
+                               if (PromptShown())\r
+                               {\r
+                                       GitDiff diff(this, this->m_hWnd, true);\r
+                                       diff.SetHEADPeg(m_LogRevision);\r
+                                       diff.ShowCompare(CTGitPath(pathURL), revPrevious, CTGitPath(pathURL), revSelected, GitRev(), false, true);\r
+                               }\r
+                               else\r
+                                       CAppUtils::StartShowCompare(m_hWnd, CTGitPath(pathURL), revPrevious, CTGitPath(pathURL), revSelected, GitRev(), m_LogRevision, false, false, true);\r
+                       }\r
+                       break;\r
+               \r
+               case ID_OPENWITH:\r
+                       bOpenWith = true;\r
+               case ID_OPEN:\r
+                       {\r
+                               CProgressDlg progDlg;\r
+                               progDlg.SetTitle(IDS_APPNAME);\r
+                               progDlg.SetAnimation(IDR_DOWNLOAD);\r
+                               CString sInfoLine;\r
+                               sInfoLine.Format(IDS_PROGRESSGETFILEREVISION, m_path.GetWinPath(), (LPCTSTR)revSelected.ToString());\r
+                               progDlg.SetLine(1, sInfoLine, true);\r
+                               SetAndClearProgressInfo(&progDlg);\r
+                               progDlg.ShowModeless(m_hWnd);\r
+                               CTGitPath tempfile = CTempFiles::Instance().GetTempFilePath(false, m_path, revSelected);\r
+                               bool bSuccess = true;\r
+                               if (!Cat(m_path, GitRev(GitRev::REV_HEAD), revSelected, tempfile))\r
+                               {\r
+                                       bSuccess = false;\r
+                                       // try again, but with the selected revision as the peg revision\r
+                                       if (!Cat(m_path, revSelected, revSelected, tempfile))\r
+                                       {\r
+                                               progDlg.Stop();\r
+                                               SetAndClearProgressInfo((HWND)NULL);\r
+                                               CMessageBox::Show(this->m_hWnd, GetLastErrorMessage(), _T("TortoiseGit"), MB_ICONERROR);\r
+                                               EnableOKButton();\r
+                                               break;\r
+                                       }\r
+                                       bSuccess = true;\r
+                               }\r
+                               if (bSuccess)\r
+                               {\r
+                                       progDlg.Stop();\r
+                                       SetAndClearProgressInfo((HWND)NULL);\r
+                                       SetFileAttributes(tempfile.GetWinPath(), FILE_ATTRIBUTE_READONLY);\r
+                                       int ret = 0;\r
+                                       if (!bOpenWith)\r
+                                               ret = (int)ShellExecute(this->m_hWnd, NULL, tempfile.GetWinPath(), NULL, NULL, SW_SHOWNORMAL);\r
+                                       if ((ret <= HINSTANCE_ERROR)||bOpenWith)\r
+                                       {\r
+                                               CString cmd = _T("RUNDLL32 Shell32,OpenAs_RunDLL ");\r
+                                               cmd += tempfile.GetWinPathString() + _T(" ");\r
+                                               CAppUtils::LaunchApplication(cmd, NULL, false);\r
+                                       }\r
+                               }\r
+                       }\r
+                       break;\r
+               case ID_BLAME:\r
+                       {\r
+                               CBlameDlg dlg;\r
+                               dlg.EndRev = revSelected;\r
+                               if (dlg.DoModal() == IDOK)\r
+                               {\r
+                                       CBlame blame;\r
+                                       CString tempfile;\r
+                                       CString logfile;\r
+                                       tempfile = blame.BlameToTempFile(m_path, dlg.StartRev, dlg.EndRev, dlg.EndRev, logfile, _T(""), dlg.m_bIncludeMerge, TRUE, TRUE);\r
+                                       if (!tempfile.IsEmpty())\r
+                                       {\r
+                                               if (dlg.m_bTextView)\r
+                                               {\r
+                                                       //open the default text editor for the result file\r
+                                                       CAppUtils::StartTextViewer(tempfile);\r
+                                               }\r
+                                               else\r
+                                               {\r
+                                                       CString sParams = _T("/path:\"") + m_path.GetGitPathString() + _T("\" ");\r
+                                                       if(!CAppUtils::LaunchTortoiseBlame(tempfile, logfile, CPathUtils::GetFileNameFromPath(m_path.GetFileOrDirectoryName()),sParams))\r
+                                                       {\r
+                                                               break;\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               CMessageBox::Show(this->m_hWnd, blame.GetLastErrorMessage(), _T("TortoiseGit"), MB_ICONERROR);\r
+                                       }\r
+                               }\r
+                       }\r
+                       break;\r
+               case ID_UPDATE:\r
+                       {\r
+                               CString sCmd;\r
+                               CString url = _T("tgit:")+pathURL;\r
+                               sCmd.Format(_T("%s /command:update /path:\"%s\" /rev:%ld"),\r
+                                       (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")),\r
+                                       (LPCTSTR)m_path.GetWinPath(), (LONG)revSelected);\r
+                               CAppUtils::LaunchApplication(sCmd, NULL, false);\r
+                       }\r
+                       break;\r
+               case ID_FINDENTRY:\r
+                       {\r
+                               m_nSearchIndex = GetSelectionMark();\r
+                               if (m_nSearchIndex < 0)\r
+                                       m_nSearchIndex = 0;\r
+                               if (m_pFindDialog)\r
+                               {\r
+                                       break;\r
+                               }\r
+                               else\r
+                               {\r
+                                       m_pFindDialog = new CFindReplaceDialog();\r
+                                       m_pFindDialog->Create(TRUE, NULL, NULL, FR_HIDEUPDOWN | FR_HIDEWHOLEWORD, this);                                                                        \r
+                               }\r
+                       }\r
+                       break;\r
+               case ID_REPOBROWSE:\r
+                       {\r
+                               CString sCmd;\r
+                               sCmd.Format(_T("%s /command:repobrowser /path:\"%s\" /rev:%s"),\r
+                                       (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")),\r
+                                       (LPCTSTR)pathURL, (LPCTSTR)revSelected.ToString());\r
+\r
+                               CAppUtils::LaunchApplication(sCmd, NULL, false);\r
+                       }\r
+                       break;\r
+               case ID_EDITLOG:\r
+                       {\r
+                               EditLogMessage(selIndex);\r
+                       }\r
+                       break;\r
+               case ID_EDITAUTHOR:\r
+                       {\r
+                               EditAuthor(selEntries);\r
+                       }\r
+                       break;\r
+               case ID_REVPROPS:\r
+                       {\r
+                               CEditPropertiesDlg dlg;\r
+                               dlg.SetProjectProperties(&m_ProjectProperties);\r
+                               CTGitPathList escapedlist;\r
+                               dlg.SetPathList(CTGitPathList(CTGitPath(pathURL)));\r
+                               dlg.SetRevision(revSelected);\r
+                               dlg.RevProps(true);\r
+                               dlg.DoModal();\r
+                       }\r
+                       break;\r
+               \r
+               case ID_EXPORT:\r
+                       {\r
+                               CString sCmd;\r
+                               sCmd.Format(_T("%s /command:export /path:\"%s\" /revision:%ld"),\r
+                                       (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")),\r
+                                       (LPCTSTR)pathURL, (LONG)revSelected);\r
+                               CAppUtils::LaunchApplication(sCmd, NULL, false);\r
+                       }\r
+                       break;\r
+               case ID_CHECKOUT:\r
+                       {\r
+                               CString sCmd;\r
+                               CString url = _T("tgit:")+pathURL;\r
+                               sCmd.Format(_T("%s /command:checkout /url:\"%s\" /revision:%ld"),\r
+                                       (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")),\r
+                                       (LPCTSTR)url, (LONG)revSelected);\r
+                               CAppUtils::LaunchApplication(sCmd, NULL, false);\r
+                       }\r
+                       break;\r
+               case ID_VIEWREV:\r
+                       {\r
+                               CString url = m_ProjectProperties.sWebViewerRev;\r
+                               url = GetAbsoluteUrlFromRelativeUrl(url);\r
+                               url.Replace(_T("%REVISION%"), revSelected.ToString());\r
+                               if (!url.IsEmpty())\r
+                                       ShellExecute(this->m_hWnd, _T("open"), url, NULL, NULL, SW_SHOWDEFAULT);                                        \r
+                       }\r
+                       break;\r
+               case ID_VIEWPATHREV:\r
+                       {\r
+                               CString relurl = pathURL;\r
+                               CString sRoot = GetRepositoryRoot(CTGitPath(relurl));\r
+                               relurl = relurl.Mid(sRoot.GetLength());\r
+                               CString url = m_ProjectProperties.sWebViewerPathRev;\r
+                               url = GetAbsoluteUrlFromRelativeUrl(url);\r
+                               url.Replace(_T("%REVISION%"), revSelected.ToString());\r
+                               url.Replace(_T("%PATH%"), relurl);\r
+                               if (!url.IsEmpty())\r
+                                       ShellExecute(this->m_hWnd, _T("open"), url, NULL, NULL, SW_SHOWDEFAULT);                                        \r
+                       }\r
+                       break;\r
+#endif\r
+               \r
+               } // switch (cmd)\r
+\r
+               theApp.DoWaitCursor(-1);\r
+}
\ No newline at end of file
similarity index 71%
rename from src/TortoiseProc/GitLogList.cpp
rename to src/TortoiseProc/GitLogListBase.cpp
index 03e1d71..d6ee45a 100644 (file)
@@ -9,12 +9,11 @@
 \r
 */\r
 #include "stdafx.h"\r
-#include "TortoiseProc.h"\r
-#include "GitLogList.h"\r
+#include "GitLogListBase.h"\r
 #include "GitRev.h"\r
 //#include "VssStyle.h"\r
 #include "IconMenu.h"\r
-// CGitLogList\r
+// CGitLogListBase\r
 #include "cursor.h"\r
 #include "InputDlg.h"\r
 #include "PropDlg.h"\r
 //#include "RepositoryInfo.h"\r
 //#include "EditPropertiesDlg.h"\r
 #include "FileDiffDlg.h"\r
+#include "..\\TortoiseShell\\Resource.h"\r
 \r
 \r
 \r
+IMPLEMENT_DYNAMIC(CGitLogListBase, CHintListCtrl)\r
 \r
-IMPLEMENT_DYNAMIC(CGitLogList, CHintListCtrl)\r
-\r
-CGitLogList::CGitLogList():CHintListCtrl()\r
+CGitLogListBase::CGitLogListBase():CHintListCtrl()\r
        ,m_regMaxBugIDColWidth(_T("Software\\TortoiseGit\\MaxBugIDColWidth"), 200)\r
        ,m_nSearchIndex(0)\r
        ,m_bNoDispUpdates(FALSE)\r
@@ -85,7 +84,7 @@ CGitLogList::CGitLogList():CHintListCtrl()
        m_To=CTime::GetCurrentTime();\r
 }\r
 \r
-CGitLogList::~CGitLogList()\r
+CGitLogListBase::~CGitLogListBase()\r
 {\r
        InterlockedExchange(&m_bNoDispUpdates, TRUE);\r
 \r
@@ -106,7 +105,7 @@ CGitLogList::~CGitLogList()
 }\r
 \r
 \r
-BEGIN_MESSAGE_MAP(CGitLogList, CHintListCtrl)\r
+BEGIN_MESSAGE_MAP(CGitLogListBase, CHintListCtrl)\r
        ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnNMCustomdrawLoglist)\r
        ON_NOTIFY_REFLECT(LVN_GETDISPINFO, OnLvnGetdispinfoLoglist)\r
        ON_WM_CONTEXTMENU()\r
@@ -115,13 +114,13 @@ BEGIN_MESSAGE_MAP(CGitLogList, CHintListCtrl)
        ON_WM_CREATE()\r
 END_MESSAGE_MAP()\r
 \r
-int CGitLogList:: OnCreate(LPCREATESTRUCT lpCreateStruct)\r
+int CGitLogListBase:: OnCreate(LPCREATESTRUCT lpCreateStruct)\r
 {\r
        PreSubclassWindow();\r
        return CHintListCtrl::OnCreate(lpCreateStruct);\r
 }\r
 \r
-void CGitLogList::PreSubclassWindow()\r
+void CGitLogListBase::PreSubclassWindow()\r
 {\r
        SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_SUBITEMIMAGES);\r
        // load the icons for the action columns\r
@@ -129,7 +128,7 @@ void CGitLogList::PreSubclassWindow()
        CHintListCtrl::PreSubclassWindow();\r
 }\r
 \r
-void CGitLogList::InsertGitColumn()\r
+void CGitLogListBase::InsertGitColumn()\r
 {\r
        CString temp;\r
 \r
@@ -179,7 +178,7 @@ void CGitLogList::InsertGitColumn()
 \r
 }\r
 \r
-void CGitLogList::ResizeAllListCtrlCols()\r
+void CGitLogListBase::ResizeAllListCtrlCols()\r
 {\r
 \r
        const int nMinimumWidth = ICONITEMBORDER+16*4;\r
@@ -265,7 +264,7 @@ void CGitLogList::ResizeAllListCtrlCols()
 }\r
 \r
 \r
-BOOL CGitLogList::GetShortName(CString ref, CString &shortname,CString prefix)\r
+BOOL CGitLogListBase::GetShortName(CString ref, CString &shortname,CString prefix)\r
 {\r
        TRACE(_T("%s %s\r\n"),ref,prefix);\r
        if(ref.Left(prefix.GetLength()) ==  prefix)\r
@@ -277,7 +276,7 @@ BOOL CGitLogList::GetShortName(CString ref, CString &shortname,CString prefix)
        }\r
        return FALSE;\r
 }\r
-void CGitLogList::FillBackGround(HDC hdc, int Index,CRect &rect)\r
+void CGitLogListBase::FillBackGround(HDC hdc, int Index,CRect &rect)\r
 {      \r
 //     HBRUSH brush;\r
        LVITEM   rItem;\r
@@ -351,7 +350,7 @@ void CGitLogList::FillBackGround(HDC hdc, int Index,CRect &rect)
        }\r
 }\r
 \r
-void CGitLogList::DrawTagBranch(HDC hdc,CRect &rect,INT_PTR index)\r
+void CGitLogListBase::DrawTagBranch(HDC hdc,CRect &rect,INT_PTR index)\r
 {\r
        GitRev* data = (GitRev*)m_arShownList.GetAt(index);\r
        CRect rt=rect;\r
@@ -427,7 +426,7 @@ void CGitLogList::DrawTagBranch(HDC hdc,CRect &rect,INT_PTR index)
        \r
 }\r
 \r
-void CGitLogList::paintGraphLane(HDC hdc, int laneHeight,int type, int x1, int x2,\r
+void CGitLogListBase::paintGraphLane(HDC hdc, int laneHeight,int type, int x1, int x2,\r
                                       const COLORREF& col,int top\r
                                                                          )  \r
 {\r
@@ -582,7 +581,7 @@ void CGitLogList::paintGraphLane(HDC hdc, int laneHeight,int type, int x1, int x
        #undef R_CENTER\r
 }\r
 \r
-void CGitLogList::DrawGraph(HDC hdc,CRect &rect,INT_PTR index)\r
+void CGitLogListBase::DrawGraph(HDC hdc,CRect &rect,INT_PTR index)\r
 {\r
        //todo unfinished\r
 //     return;\r
@@ -641,7 +640,7 @@ void CGitLogList::DrawGraph(HDC hdc,CRect &rect,INT_PTR index)
        TRACE(_T("index %d %d\r\n"),index,data->m_Lanes.size());\r
 }\r
 \r
-void CGitLogList::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult)\r
+void CGitLogListBase::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult)\r
 {\r
 \r
        NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );\r
@@ -805,9 +804,9 @@ void CGitLogList::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult)
 \r
 }\r
 \r
-// CGitLogList message handlers\r
+// CGitLogListBase message handlers\r
 \r
-void CGitLogList::OnLvnGetdispinfoLoglist(NMHDR *pNMHDR, LRESULT *pResult)\r
+void CGitLogListBase::OnLvnGetdispinfoLoglist(NMHDR *pNMHDR, LRESULT *pResult)\r
 {\r
        NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);\r
 \r
@@ -865,7 +864,7 @@ void CGitLogList::OnLvnGetdispinfoLoglist(NMHDR *pNMHDR, LRESULT *pResult)
        }\r
 }\r
 \r
-void CGitLogList::OnContextMenu(CWnd* pWnd, CPoint point)\r
+void CGitLogListBase::OnContextMenu(CWnd* pWnd, CPoint point)\r
 {\r
 \r
        int selIndex = GetSelectionMark();\r
@@ -1073,455 +1072,15 @@ void CGitLogList::OnContextMenu(CWnd* pWnd, CPoint point)
                int cmd = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, point.x, point.y, this, 0);\r
 //             DialogEnableWindow(IDOK, FALSE);\r
 //             SetPromptApp(&theApp);\r
-               theApp.DoWaitCursor(1);\r
-               bool bOpenWith = false;\r
-\r
-               switch (cmd)\r
-               {\r
-                       case ID_GNUDIFF1:\r
-                       {\r
-                               CString tempfile=GetTempFile();\r
-                               CString cmd;\r
-                               GitRev * r1 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(FirstSelect));\r
-                               cmd.Format(_T("git.exe diff-tree -r -p --stat %s"),r1->m_CommitHash);\r
-                               g_Git.RunLogFile(cmd,tempfile);\r
-                               CAppUtils::StartUnifiedDiffViewer(tempfile,r1->m_CommitHash.Left(6)+_T(":")+r1->m_Subject);\r
-                       }\r
-                       break;\r
-\r
-                       case ID_GNUDIFF2:\r
-                       {\r
-                               CString tempfile=GetTempFile();\r
-                               CString cmd;\r
-                               GitRev * r1 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(FirstSelect));\r
-                               GitRev * r2 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(LastSelect));\r
-                               cmd.Format(_T("git.exe diff-tree -r -p --stat %s %s"),r1->m_CommitHash,r2->m_CommitHash);\r
-                               g_Git.RunLogFile(cmd,tempfile);\r
-                               CAppUtils::StartUnifiedDiffViewer(tempfile,r1->m_CommitHash.Left(6)+_T(":")+r2->m_CommitHash.Left(6));\r
-\r
-                       }\r
-                       break;\r
-\r
-               case ID_COMPARETWO:\r
-                       {\r
-                               GitRev * r1 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(FirstSelect));\r
-                               GitRev * r2 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(LastSelect));\r
-                               CFileDiffDlg dlg;\r
-                               dlg.SetDiff(NULL,*r1,*r2);\r
-                               dlg.DoModal();\r
-                               \r
-                       }\r
-                       break;\r
-               \r
-\r
-               case ID_COMPARE:\r
-                       {\r
-                               GitRev * r1 = &m_wcRev;\r
-                               GitRev * r2 = pSelLogEntry;\r
-                               CFileDiffDlg dlg;\r
-                               dlg.SetDiff(NULL,*r1,*r2);\r
-                               dlg.DoModal();\r
-\r
-                               //user clicked on the menu item "compare with working copy"\r
-                               //if (PromptShown())\r
-                               //{\r
-                               //      GitDiff diff(this, m_hWnd, true);\r
-                               //      diff.SetAlternativeTool(!!(GetAsyncKeyState(VK_SHIFT) & 0x8000));\r
-                               //      diff.SetHEADPeg(m_LogRevision);\r
-                               //      diff.ShowCompare(m_path, GitRev::REV_WC, m_path, revSelected);\r
-                               //}\r
-                               //else\r
-                               //      CAppUtils::StartShowCompare(m_hWnd, m_path, GitRev::REV_WC, m_path, revSelected, GitRev(), m_LogRevision, !!(GetAsyncKeyState(VK_SHIFT) & 0x8000));\r
-                       }\r
-                       break;\r
-\r
-               case ID_COMPAREWITHPREVIOUS:\r
-                       {\r
-\r
-                               CFileDiffDlg dlg;\r
-                               \r
-                               if(pSelLogEntry->m_ParentHash.size()>0)\r
-                               //if(m_logEntries.m_HashMap[pSelLogEntry->m_ParentHash[0]]>=0)\r
-                               {\r
-                                       dlg.SetDiff(NULL,pSelLogEntry->m_CommitHash,pSelLogEntry->m_ParentHash[0]);\r
-                                       dlg.DoModal();\r
-                               }else\r
-                               {\r
-                                       CMessageBox::Show(NULL,_T("No previous version"),_T("TortoiseGit"),MB_OK);      \r
-                               }\r
-                               //if (PromptShown())\r
-                               //{\r
-                               //      GitDiff diff(this, m_hWnd, true);\r
-                               //      diff.SetAlternativeTool(!!(GetAsyncKeyState(VK_SHIFT) & 0x8000));\r
-                               //      diff.SetHEADPeg(m_LogRevision);\r
-                               //      diff.ShowCompare(CTGitPath(pathURL), revPrevious, CTGitPath(pathURL), revSelected);\r
-                               //}\r
-                               //else\r
-                               //      CAppUtils::StartShowCompare(m_hWnd, CTGitPath(pathURL), revPrevious, CTGitPath(pathURL), revSelected, GitRev(), m_LogRevision, !!(GetAsyncKeyState(VK_SHIFT) & 0x8000));\r
-                       }\r
-                       break;\r
-               case ID_COPYCLIPBOARD:\r
-                       {\r
-                               CopySelectionToClipBoard();\r
-                       }\r
-                       break;\r
-               case ID_COPYHASH:\r
-                       {\r
-                               CopySelectionToClipBoard(TRUE);\r
-                       }\r
-                       break;\r
-               case ID_EXPORT:\r
-                       CAppUtils::Export(&pSelLogEntry->m_CommitHash);\r
-                       break;\r
-               case ID_CREATE_BRANCH:\r
-                       CAppUtils::CreateBranchTag(FALSE,&pSelLogEntry->m_CommitHash);\r
-                       m_HashMap.clear();\r
-                       g_Git.GetMapHashToFriendName(m_HashMap);\r
-                       Invalidate();                   \r
-                       break;\r
-               case ID_CREATE_TAG:\r
-                       CAppUtils::CreateBranchTag(TRUE,&pSelLogEntry->m_CommitHash);\r
-                       m_HashMap.clear();\r
-                       g_Git.GetMapHashToFriendName(m_HashMap);\r
-                       Invalidate();\r
-                       break;\r
-               case ID_SWITCHTOREV:\r
-                       CAppUtils::Switch(&pSelLogEntry->m_CommitHash);\r
-                       m_HashMap.clear();\r
-                       g_Git.GetMapHashToFriendName(m_HashMap);\r
-                       Invalidate();\r
-                       break;\r
-\r
-               default:\r
-                       //CMessageBox::Show(NULL,_T("Have not implemented"),_T("TortoiseGit"),MB_OK);\r
-                       break;\r
-#if 0\r
-       \r
-               case ID_REVERTREV:\r
-                       {\r
-                               // we need an URL to complete this command, so error out if we can't get an URL\r
-                               if (pathURL.IsEmpty())\r
-                               {\r
-                                       CString strMessage;\r
-                                       strMessage.Format(IDS_ERR_NOURLOFFILE, (LPCTSTR)(m_path.GetUIPathString()));\r
-                                       CMessageBox::Show(this->m_hWnd, strMessage, _T("TortoiseGit"), MB_ICONERROR);\r
-                                       TRACE(_T("could not retrieve the URL of the folder!\n"));\r
-                                       break;          //exit\r
-                               }\r
-                               CString msg;\r
-                               msg.Format(IDS_LOG_REVERT_CONFIRM, m_path.GetWinPath());\r
-                               if (CMessageBox::Show(this->m_hWnd, msg, _T("TortoiseGit"), MB_YESNO | MB_ICONQUESTION) == IDYES)\r
-                               {\r
-                                       CGitProgressDlg dlg;\r
-                                       dlg.SetCommand(CGitProgressDlg::GitProgress_Merge);\r
-                                       dlg.SetPathList(CTGitPathList(m_path));\r
-                                       dlg.SetUrl(pathURL);\r
-                                       dlg.SetSecondUrl(pathURL);\r
-                                       revisionRanges.AdjustForMerge(true);\r
-                                       dlg.SetRevisionRanges(revisionRanges);\r
-                                       dlg.SetPegRevision(m_LogRevision);\r
-                                       dlg.DoModal();\r
-                               }\r
-                       }\r
-                       break;\r
-               case ID_MERGEREV:\r
-                       {\r
-                               // we need an URL to complete this command, so error out if we can't get an URL\r
-                               if (pathURL.IsEmpty())\r
-                               {\r
-                                       CString strMessage;\r
-                                       strMessage.Format(IDS_ERR_NOURLOFFILE, (LPCTSTR)(m_path.GetUIPathString()));\r
-                                       CMessageBox::Show(this->m_hWnd, strMessage, _T("TortoiseGit"), MB_ICONERROR);\r
-                                       TRACE(_T("could not retrieve the URL of the folder!\n"));\r
-                                       break;          //exit\r
-                               }\r
-\r
-                               CString path = m_path.GetWinPathString();\r
-                               bool bGotSavePath = false;\r
-                               if ((GetSelectedCount() == 1)&&(!m_path.IsDirectory()))\r
-                               {\r
-                                       bGotSavePath = CAppUtils::FileOpenSave(path, NULL, IDS_LOG_MERGETO, IDS_COMMONFILEFILTER, true, GetSafeHwnd());\r
-                               }\r
-                               else\r
-                               {\r
-                                       CBrowseFolder folderBrowser;\r
-                                       folderBrowser.SetInfo(CString(MAKEINTRESOURCE(IDS_LOG_MERGETO)));\r
-                                       bGotSavePath = (folderBrowser.Show(GetSafeHwnd(), path, path) == CBrowseFolder::OK);\r
-                               }\r
-                               if (bGotSavePath)\r
-                               {\r
-                                       CGitProgressDlg dlg;\r
-                                       dlg.SetCommand(CGitProgressDlg::GitProgress_Merge);\r
-                                       dlg.SetPathList(CTGitPathList(CTGitPath(path)));\r
-                                       dlg.SetUrl(pathURL);\r
-                                       dlg.SetSecondUrl(pathURL);\r
-                                       revisionRanges.AdjustForMerge(false);\r
-                                       dlg.SetRevisionRanges(revisionRanges);\r
-                                       dlg.SetPegRevision(m_LogRevision);\r
-                                       dlg.DoModal();\r
-                               }\r
-                       }\r
-                       break;\r
-               case ID_REVERTTOREV:\r
-                       {\r
-                               // we need an URL to complete this command, so error out if we can't get an URL\r
-                               if (pathURL.IsEmpty())\r
-                               {\r
-                                       CString strMessage;\r
-                                       strMessage.Format(IDS_ERR_NOURLOFFILE, (LPCTSTR)(m_path.GetUIPathString()));\r
-                                       CMessageBox::Show(this->m_hWnd, strMessage, _T("TortoiseGit"), MB_ICONERROR);\r
-                                       TRACE(_T("could not retrieve the URL of the folder!\n"));\r
-                                       break;          //exit\r
-                               }\r
-\r
-                               CString msg;\r
-                               msg.Format(IDS_LOG_REVERTTOREV_CONFIRM, m_path.GetWinPath());\r
-                               if (CMessageBox::Show(this->m_hWnd, msg, _T("TortoiseGit"), MB_YESNO | MB_ICONQUESTION) == IDYES)\r
-                               {\r
-                                       CGitProgressDlg dlg;\r
-                                       dlg.SetCommand(CGitProgressDlg::GitProgress_Merge);\r
-                                       dlg.SetPathList(CTGitPathList(m_path));\r
-                                       dlg.SetUrl(pathURL);\r
-                                       dlg.SetSecondUrl(pathURL);\r
-                                       GitRevRangeArray revarray;\r
-                                       revarray.AddRevRange(GitRev::REV_HEAD, revSelected);\r
-                                       dlg.SetRevisionRanges(revarray);\r
-                                       dlg.SetPegRevision(m_LogRevision);\r
-                                       dlg.DoModal();\r
-                               }\r
-                       }\r
-                       break;\r
-       \r
-\r
        \r
-               case ID_BLAMECOMPARE:\r
-                       {\r
-                               //user clicked on the menu item "compare with working copy"\r
-                               //now first get the revision which is selected\r
-                               if (PromptShown())\r
-                               {\r
-                                       GitDiff diff(this, this->m_hWnd, true);\r
-                                       diff.SetHEADPeg(m_LogRevision);\r
-                                       diff.ShowCompare(m_path, GitRev::REV_BASE, m_path, revSelected, GitRev(), false, true);\r
-                               }\r
-                               else\r
-                                       CAppUtils::StartShowCompare(m_hWnd, m_path, GitRev::REV_BASE, m_path, revSelected, GitRev(), m_LogRevision, false, false, true);\r
-                       }\r
-                       break;\r
-               case ID_BLAMETWO:\r
-                       {\r
-                               //user clicked on the menu item "compare and blame revisions"\r
-                               if (PromptShown())\r
-                               {\r
-                                       GitDiff diff(this, this->m_hWnd, true);\r
-                                       diff.SetHEADPeg(m_LogRevision);\r
-                                       diff.ShowCompare(CTGitPath(pathURL), revSelected2, CTGitPath(pathURL), revSelected, GitRev(), false, true);\r
-                               }\r
-                               else\r
-                                       CAppUtils::StartShowCompare(m_hWnd, CTGitPath(pathURL), revSelected2, CTGitPath(pathURL), revSelected, GitRev(), m_LogRevision, false, false, true);\r
-                       }\r
-                       break;\r
-               case ID_BLAMEWITHPREVIOUS:\r
-                       {\r
-                               //user clicked on the menu item "Compare and Blame with previous revision"\r
-                               if (PromptShown())\r
-                               {\r
-                                       GitDiff diff(this, this->m_hWnd, true);\r
-                                       diff.SetHEADPeg(m_LogRevision);\r
-                                       diff.ShowCompare(CTGitPath(pathURL), revPrevious, CTGitPath(pathURL), revSelected, GitRev(), false, true);\r
-                               }\r
-                               else\r
-                                       CAppUtils::StartShowCompare(m_hWnd, CTGitPath(pathURL), revPrevious, CTGitPath(pathURL), revSelected, GitRev(), m_LogRevision, false, false, true);\r
-                       }\r
-                       break;\r
-               \r
-               case ID_OPENWITH:\r
-                       bOpenWith = true;\r
-               case ID_OPEN:\r
-                       {\r
-                               CProgressDlg progDlg;\r
-                               progDlg.SetTitle(IDS_APPNAME);\r
-                               progDlg.SetAnimation(IDR_DOWNLOAD);\r
-                               CString sInfoLine;\r
-                               sInfoLine.Format(IDS_PROGRESSGETFILEREVISION, m_path.GetWinPath(), (LPCTSTR)revSelected.ToString());\r
-                               progDlg.SetLine(1, sInfoLine, true);\r
-                               SetAndClearProgressInfo(&progDlg);\r
-                               progDlg.ShowModeless(m_hWnd);\r
-                               CTGitPath tempfile = CTempFiles::Instance().GetTempFilePath(false, m_path, revSelected);\r
-                               bool bSuccess = true;\r
-                               if (!Cat(m_path, GitRev(GitRev::REV_HEAD), revSelected, tempfile))\r
-                               {\r
-                                       bSuccess = false;\r
-                                       // try again, but with the selected revision as the peg revision\r
-                                       if (!Cat(m_path, revSelected, revSelected, tempfile))\r
-                                       {\r
-                                               progDlg.Stop();\r
-                                               SetAndClearProgressInfo((HWND)NULL);\r
-                                               CMessageBox::Show(this->m_hWnd, GetLastErrorMessage(), _T("TortoiseGit"), MB_ICONERROR);\r
-                                               EnableOKButton();\r
-                                               break;\r
-                                       }\r
-                                       bSuccess = true;\r
-                               }\r
-                               if (bSuccess)\r
-                               {\r
-                                       progDlg.Stop();\r
-                                       SetAndClearProgressInfo((HWND)NULL);\r
-                                       SetFileAttributes(tempfile.GetWinPath(), FILE_ATTRIBUTE_READONLY);\r
-                                       int ret = 0;\r
-                                       if (!bOpenWith)\r
-                                               ret = (int)ShellExecute(this->m_hWnd, NULL, tempfile.GetWinPath(), NULL, NULL, SW_SHOWNORMAL);\r
-                                       if ((ret <= HINSTANCE_ERROR)||bOpenWith)\r
-                                       {\r
-                                               CString cmd = _T("RUNDLL32 Shell32,OpenAs_RunDLL ");\r
-                                               cmd += tempfile.GetWinPathString() + _T(" ");\r
-                                               CAppUtils::LaunchApplication(cmd, NULL, false);\r
-                                       }\r
-                               }\r
-                       }\r
-                       break;\r
-               case ID_BLAME:\r
-                       {\r
-                               CBlameDlg dlg;\r
-                               dlg.EndRev = revSelected;\r
-                               if (dlg.DoModal() == IDOK)\r
-                               {\r
-                                       CBlame blame;\r
-                                       CString tempfile;\r
-                                       CString logfile;\r
-                                       tempfile = blame.BlameToTempFile(m_path, dlg.StartRev, dlg.EndRev, dlg.EndRev, logfile, _T(""), dlg.m_bIncludeMerge, TRUE, TRUE);\r
-                                       if (!tempfile.IsEmpty())\r
-                                       {\r
-                                               if (dlg.m_bTextView)\r
-                                               {\r
-                                                       //open the default text editor for the result file\r
-                                                       CAppUtils::StartTextViewer(tempfile);\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       CString sParams = _T("/path:\"") + m_path.GetGitPathString() + _T("\" ");\r
-                                                       if(!CAppUtils::LaunchTortoiseBlame(tempfile, logfile, CPathUtils::GetFileNameFromPath(m_path.GetFileOrDirectoryName()),sParams))\r
-                                                       {\r
-                                                               break;\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               CMessageBox::Show(this->m_hWnd, blame.GetLastErrorMessage(), _T("TortoiseGit"), MB_ICONERROR);\r
-                                       }\r
-                               }\r
-                       }\r
-                       break;\r
-               case ID_UPDATE:\r
-                       {\r
-                               CString sCmd;\r
-                               CString url = _T("tgit:")+pathURL;\r
-                               sCmd.Format(_T("%s /command:update /path:\"%s\" /rev:%ld"),\r
-                                       (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")),\r
-                                       (LPCTSTR)m_path.GetWinPath(), (LONG)revSelected);\r
-                               CAppUtils::LaunchApplication(sCmd, NULL, false);\r
-                       }\r
-                       break;\r
-               case ID_FINDENTRY:\r
-                       {\r
-                               m_nSearchIndex = GetSelectionMark();\r
-                               if (m_nSearchIndex < 0)\r
-                                       m_nSearchIndex = 0;\r
-                               if (m_pFindDialog)\r
-                               {\r
-                                       break;\r
-                               }\r
-                               else\r
-                               {\r
-                                       m_pFindDialog = new CFindReplaceDialog();\r
-                                       m_pFindDialog->Create(TRUE, NULL, NULL, FR_HIDEUPDOWN | FR_HIDEWHOLEWORD, this);                                                                        \r
-                               }\r
-                       }\r
-                       break;\r
-               case ID_REPOBROWSE:\r
-                       {\r
-                               CString sCmd;\r
-                               sCmd.Format(_T("%s /command:repobrowser /path:\"%s\" /rev:%s"),\r
-                                       (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")),\r
-                                       (LPCTSTR)pathURL, (LPCTSTR)revSelected.ToString());\r
-\r
-                               CAppUtils::LaunchApplication(sCmd, NULL, false);\r
-                       }\r
-                       break;\r
-               case ID_EDITLOG:\r
-                       {\r
-                               EditLogMessage(selIndex);\r
-                       }\r
-                       break;\r
-               case ID_EDITAUTHOR:\r
-                       {\r
-                               EditAuthor(selEntries);\r
-                       }\r
-                       break;\r
-               case ID_REVPROPS:\r
-                       {\r
-                               CEditPropertiesDlg dlg;\r
-                               dlg.SetProjectProperties(&m_ProjectProperties);\r
-                               CTGitPathList escapedlist;\r
-                               dlg.SetPathList(CTGitPathList(CTGitPath(pathURL)));\r
-                               dlg.SetRevision(revSelected);\r
-                               dlg.RevProps(true);\r
-                               dlg.DoModal();\r
-                       }\r
-                       break;\r
-               \r
-               case ID_EXPORT:\r
-                       {\r
-                               CString sCmd;\r
-                               sCmd.Format(_T("%s /command:export /path:\"%s\" /revision:%ld"),\r
-                                       (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")),\r
-                                       (LPCTSTR)pathURL, (LONG)revSelected);\r
-                               CAppUtils::LaunchApplication(sCmd, NULL, false);\r
-                       }\r
-                       break;\r
-               case ID_CHECKOUT:\r
-                       {\r
-                               CString sCmd;\r
-                               CString url = _T("tgit:")+pathURL;\r
-                               sCmd.Format(_T("%s /command:checkout /url:\"%s\" /revision:%ld"),\r
-                                       (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")),\r
-                                       (LPCTSTR)url, (LONG)revSelected);\r
-                               CAppUtils::LaunchApplication(sCmd, NULL, false);\r
-                       }\r
-                       break;\r
-               case ID_VIEWREV:\r
-                       {\r
-                               CString url = m_ProjectProperties.sWebViewerRev;\r
-                               url = GetAbsoluteUrlFromRelativeUrl(url);\r
-                               url.Replace(_T("%REVISION%"), revSelected.ToString());\r
-                               if (!url.IsEmpty())\r
-                                       ShellExecute(this->m_hWnd, _T("open"), url, NULL, NULL, SW_SHOWDEFAULT);                                        \r
-                       }\r
-                       break;\r
-               case ID_VIEWPATHREV:\r
-                       {\r
-                               CString relurl = pathURL;\r
-                               CString sRoot = GetRepositoryRoot(CTGitPath(relurl));\r
-                               relurl = relurl.Mid(sRoot.GetLength());\r
-                               CString url = m_ProjectProperties.sWebViewerPathRev;\r
-                               url = GetAbsoluteUrlFromRelativeUrl(url);\r
-                               url.Replace(_T("%REVISION%"), revSelected.ToString());\r
-                               url.Replace(_T("%PATH%"), relurl);\r
-                               if (!url.IsEmpty())\r
-                                       ShellExecute(this->m_hWnd, _T("open"), url, NULL, NULL, SW_SHOWDEFAULT);                                        \r
-                       }\r
-                       break;\r
-#endif\r
+               this->ContextMenuAction(cmd, FirstSelect, LastSelect);\r
                \r
-               } // switch (cmd)\r
-               theApp.DoWaitCursor(-1);\r
 //             EnableOKButton();\r
        } // if (popup.CreatePopupMenu())\r
 \r
 }\r
 \r
-bool CGitLogList::IsSelectionContinuous()\r
+bool CGitLogListBase::IsSelectionContinuous()\r
 {\r
        if ( GetSelectedCount()==1 )\r
        {\r
@@ -1549,7 +1108,7 @@ bool CGitLogList::IsSelectionContinuous()
        return bContinuous;\r
 }\r
 \r
-void CGitLogList::CopySelectionToClipBoard(bool HashOnly)\r
+void CGitLogListBase::CopySelectionToClipBoard(bool HashOnly)\r
 {\r
 \r
        CString sClipdata;\r
@@ -1600,7 +1159,7 @@ void CGitLogList::CopySelectionToClipBoard(bool HashOnly)
 \r
 }\r
 \r
-void CGitLogList::DiffSelectedRevWithPrevious()\r
+void CGitLogListBase::DiffSelectedRevWithPrevious()\r
 {\r
 #if 0\r
        if (m_bThreadRunning)\r
@@ -1662,7 +1221,7 @@ void CGitLogList::DiffSelectedRevWithPrevious()
 #endif\r
 }\r
 \r
-void CGitLogList::OnLvnOdfinditemLoglist(NMHDR *pNMHDR, LRESULT *pResult)\r
+void CGitLogListBase::OnLvnOdfinditemLoglist(NMHDR *pNMHDR, LRESULT *pResult)\r
 {\r
        LPNMLVFINDITEM pFindInfo = reinterpret_cast<LPNMLVFINDITEM>(pNMHDR);\r
        *pResult = -1;\r
@@ -1725,7 +1284,7 @@ void CGitLogList::OnLvnOdfinditemLoglist(NMHDR *pNMHDR, LRESULT *pResult)
        *pResult = -1;\r
 }\r
 \r
-int CGitLogList::FillGitShortLog()\r
+int CGitLogListBase::FillGitShortLog()\r
 {\r
        ClearText();\r
 \r
@@ -1743,7 +1302,7 @@ int CGitLogList::FillGitShortLog()
        return 0;\r
 }\r
 \r
-BOOL CGitLogList::PreTranslateMessage(MSG* pMsg)\r
+BOOL CGitLogListBase::PreTranslateMessage(MSG* pMsg)\r
 {\r
        // Skip Ctrl-C when copying text out of the log message or search filter\r
        BOOL bSkipAccelerator = ( pMsg->message == WM_KEYDOWN && pMsg->wParam=='C' && (GetFocus()==GetDlgItem(IDC_MSGVIEW) || GetFocus()==GetDlgItem(IDC_SEARCHEDIT) ) && GetKeyState(VK_CONTROL)&0x8000 );\r
@@ -1779,7 +1338,7 @@ BOOL CGitLogList::PreTranslateMessage(MSG* pMsg)
        return __super::PreTranslateMessage(pMsg);\r
 }\r
 \r
-void CGitLogList::OnNMDblclkLoglist(NMHDR * /*pNMHDR*/, LRESULT *pResult)\r
+void CGitLogListBase::OnNMDblclkLoglist(NMHDR * /*pNMHDR*/, LRESULT *pResult)\r
 {\r
        // a double click on an entry in the revision list has happened\r
        *pResult = 0;\r
@@ -1788,7 +1347,7 @@ void CGitLogList::OnNMDblclkLoglist(NMHDR * /*pNMHDR*/, LRESULT *pResult)
          DiffSelectedRevWithPrevious();\r
 }\r
 \r
-int CGitLogList::FetchLogAsync(CALLBACK_PROCESS *proc,void * data)\r
+int CGitLogListBase::FetchLogAsync(CALLBACK_PROCESS *proc,void * data)\r
 {\r
        m_ProcCallBack=proc;\r
        m_ProcData=data;\r
@@ -1806,12 +1365,12 @@ int CGitLogList::FetchLogAsync(CALLBACK_PROCESS *proc,void * data)
 }\r
 \r
 //this is the thread function which calls the subversion function\r
-UINT CGitLogList::LogThreadEntry(LPVOID pVoid)\r
+UINT CGitLogListBase::LogThreadEntry(LPVOID pVoid)\r
 {\r
-       return ((CGitLogList*)pVoid)->LogThread();\r
+       return ((CGitLogListBase*)pVoid)->LogThread();\r
 }\r
 \r
-void CGitLogList::GetTimeRange(CTime &oldest, CTime &latest)\r
+void CGitLogListBase::GetTimeRange(CTime &oldest, CTime &latest)\r
 {\r
        //CTime time;\r
        oldest=CTime::GetCurrentTime();\r
@@ -1827,7 +1386,7 @@ void CGitLogList::GetTimeRange(CTime &oldest, CTime &latest)
        }\r
 }\r
 \r
-UINT CGitLogList::LogThread()\r
+UINT CGitLogListBase::LogThread()\r
 {\r
 \r
        if(m_ProcCallBack)\r
@@ -1912,7 +1471,7 @@ UINT CGitLogList::LogThread()
        return 0;\r
 }\r
 \r
-void CGitLogList::Refresh()\r
+void CGitLogListBase::Refresh()\r
 {\r
        if(!m_bThreadRunning)\r
        {\r
@@ -1931,7 +1490,7 @@ void CGitLogList::Refresh()
                m_To=CTime::GetCurrentTime();\r
        }\r
 }\r
-bool CGitLogList::ValidateRegexp(LPCTSTR regexp_str, tr1::wregex& pat, bool bMatchCase /* = false */)\r
+bool CGitLogListBase::ValidateRegexp(LPCTSTR regexp_str, tr1::wregex& pat, bool bMatchCase /* = false */)\r
 {\r
        try\r
        {\r
@@ -1945,7 +1504,7 @@ bool CGitLogList::ValidateRegexp(LPCTSTR regexp_str, tr1::wregex& pat, bool bMat
        return false;\r
 }\r
 \r
-void CGitLogList::RecalculateShownList(CPtrArray * pShownlist)\r
+void CGitLogListBase::RecalculateShownList(CPtrArray * pShownlist)\r
 {\r
 \r
        pShownlist->RemoveAll();\r
@@ -2133,7 +1692,7 @@ void CGitLogList::RecalculateShownList(CPtrArray * pShownlist)
 \r
 }\r
 \r
-BOOL CGitLogList::IsEntryInDateRange(int i)\r
+BOOL CGitLogListBase::IsEntryInDateRange(int i)\r
 {\r
        __time64_t time = m_logEntries[i].m_AuthorDate.GetTime();\r
        if ((time >= m_From.GetTime())&&(time <= m_To.GetTime()))\r
@@ -2143,7 +1702,7 @@ BOOL CGitLogList::IsEntryInDateRange(int i)
 \r
 //     return TRUE;\r
 }\r
-void CGitLogList::StartFilter()\r
+void CGitLogListBase::StartFilter()\r
 {\r
        InterlockedExchange(&m_bNoDispUpdates, TRUE);\r
        RecalculateShownList(&m_arShownList);\r
@@ -2158,7 +1717,7 @@ void CGitLogList::StartFilter()
        SetRedraw(true);\r
        Invalidate();\r
 }\r
-void CGitLogList::RemoveFilter()\r
+void CGitLogListBase::RemoveFilter()\r
 {\r
 \r
        InterlockedExchange(&m_bNoDispUpdates, TRUE);\r
diff --git a/src/TortoiseProc/GitLogListBase.h b/src/TortoiseProc/GitLogListBase.h
new file mode 100644 (file)
index 0000000..ad4a3ac
--- /dev/null
@@ -0,0 +1,197 @@
+#pragma once\r
+\r
+#include "HintListCtrl.h"\r
+#include "XPTheme.h"\r
+#include "resource.h"\r
+#include "Git.h"\r
+#include "ProjectProperties.h"\r
+#include "TGitPath.h"\r
+#include "registry.h"\r
+#include "SplitterControl.h"\r
+#include "Colors.h"\r
+#include "MenuButton.h"\r
+#include "LogDlgHelper.h"\r
+#include "FilterEdit.h"\r
+#include "GitRev.h"\r
+#include "Tooltip.h"\r
+#include "HintListCtrl.h"\r
+//#include "GitLogList.h"\r
+#include "lanes.h"\r
+\r
+#include <regex>\r
+// CGitLogList\r
+#if (NTDDI_VERSION < NTDDI_LONGHORN)\r
+\r
+enum LISTITEMSTATES_MINE {\r
+       LISS_NORMAL = 1,\r
+       LISS_HOT = 2,\r
+       LISS_SELECTED = 3,\r
+       LISS_DISABLED = 4,\r
+       LISS_SELECTEDNOTFOCUS = 5,\r
+       LISS_HOTSELECTED = 6,\r
+};\r
+\r
+#define MCS_NOTRAILINGDATES  0x0040\r
+#define MCS_SHORTDAYSOFWEEK  0x0080\r
+#define MCS_NOSELCHANGEONNAV 0x0100\r
+\r
+#define DTM_SETMCSTYLE    (DTM_FIRST + 11)\r
+\r
+#endif\r
+\r
+#define ICONITEMBORDER 5\r
+\r
+#define GITLOG_START 0\r
+#define GITLOG_START_ALL 1\r
+#define GITLOG_END   100\r
+\r
+#define LOGFILTER_ALL      1\r
+#define LOGFILTER_MESSAGES 2\r
+#define LOGFILTER_PATHS    3\r
+#define LOGFILTER_AUTHORS  4\r
+#define LOGFILTER_REVS    5\r
+#define LOGFILTER_REGEX           6\r
+#define LOGFILTER_BUGID    7\r
+\r
+typedef void CALLBACK_PROCESS(void * data, int progress);\r
+\r
+class CGitLogListBase : public CHintListCtrl\r
+{\r
+       DECLARE_DYNAMIC(CGitLogListBase)\r
+\r
+public:\r
+       CGitLogListBase();\r
+       virtual ~CGitLogListBase();\r
+       volatile LONG           m_bNoDispUpdates;\r
+       BOOL m_bStrictStopped;\r
+       BOOL m_bShowBugtraqColumn;\r
+       BOOL m_bSearchIndex;\r
+       BOOL m_bCancelled;\r
+       bool                            m_hasWC;\r
+       GitRev                          m_wcRev;\r
+       volatile LONG           m_bThreadRunning;\r
+\r
+       enum\r
+       {\r
+               LOGLIST_GRAPH,\r
+               LOGLIST_ACTION,\r
+               LOGLIST_MESSAGE,\r
+               LOGLIST_AUTHOR,\r
+               LOGLIST_DATE,\r
+               LOGLIST_BUG,\r
+               LOGLIST_MESSAGE_MAX=300,\r
+               LOGLIST_MESSAGE_MIN=200\r
+       };\r
+\r
+       enum \r
+       {\r
+       // needs to start with 1, since 0 is the return value if *nothing* is clicked on in the context menu\r
+       ID_COMPARE = 1,\r
+       ID_SAVEAS,\r
+       ID_COMPARETWO,\r
+       ID_UPDATE,\r
+       ID_COPY,\r
+       ID_REVERTREV,\r
+       ID_MERGEREV,\r
+       ID_GNUDIFF1,\r
+       ID_GNUDIFF2,\r
+       ID_FINDENTRY,\r
+       ID_OPEN,\r
+       ID_BLAME,\r
+       ID_REPOBROWSE,\r
+       ID_LOG,\r
+       ID_POPPROPS,\r
+       ID_EDITAUTHOR,\r
+       ID_EDITLOG,\r
+       ID_DIFF,\r
+       ID_OPENWITH,\r
+       ID_COPYCLIPBOARD,\r
+       ID_COPYHASH,\r
+       ID_CHECKOUT,\r
+       ID_REVERTTOREV,\r
+       ID_BLAMECOMPARE,\r
+       ID_BLAMETWO,\r
+       ID_BLAMEDIFF,\r
+       ID_VIEWREV,\r
+       ID_VIEWPATHREV,\r
+       ID_EXPORT,\r
+       ID_COMPAREWITHPREVIOUS,\r
+       ID_BLAMEWITHPREVIOUS,\r
+       ID_GETMERGELOGS,\r
+       ID_REVPROPS,\r
+       ID_CHERRY_PICK,\r
+       ID_CREATE_BRANCH,\r
+       ID_CREATE_TAG,\r
+       ID_SWITCHTOREV\r
+       };\r
+       void InsertGitColumn();\r
+       void ResizeAllListCtrlCols();\r
+       void CopySelectionToClipBoard(bool hashonly=FALSE);\r
+       void DiffSelectedRevWithPrevious();\r
+       bool IsSelectionContinuous();\r
+       int  FillGitShortLog();\r
+       inline int ShownCountWithStopped() const { return (int)m_arShownList.GetCount() + (m_bStrictStopped ? 1 : 0); }\r
+       int FetchLogAsync(CALLBACK_PROCESS *proc=NULL, void * data=NULL);\r
+       CPtrArray                       m_arShownList;\r
+       void Refresh();\r
+       void RecalculateShownList(CPtrArray * pShownlist);\r
+\r
+       int                                     m_nSelectedFilter;\r
+       CLogDataVector          m_logEntries;\r
+       void RemoveFilter();\r
+       void StartFilter();\r
+       bool ValidateRegexp(LPCTSTR regexp_str, tr1::wregex& pat, bool bMatchCase = false );\r
+       CString                         m_sFilterText;\r
+       CTime                   m_From;\r
+       CTime                   m_To;\r
+       void                            GetTimeRange(CTime &oldest,CTime &latest);\r
+       virtual void ContextMenuAction(int cmd,int FirstSelect, int LastSelect)=0;\r
+protected:\r
+       DECLARE_MESSAGE_MAP()\r
+       afx_msg void OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult);\r
+       afx_msg void OnLvnGetdispinfoLoglist(NMHDR *pNMHDR, LRESULT *pResult);\r
+       afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);\r
+       afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);\r
+       void OnNMDblclkLoglist(NMHDR * /*pNMHDR*/, LRESULT *pResult);\r
+       afx_msg void OnLvnOdfinditemLoglist(NMHDR *pNMHDR, LRESULT *pResult);\r
+       void PreSubclassWindow();\r
+       virtual BOOL PreTranslateMessage(MSG* pMsg);\r
+       static UINT LogThreadEntry(LPVOID pVoid);\r
+       UINT LogThread();\r
+       void FillBackGround(HDC hdc, int Index,CRect &rect);\r
+       void DrawTagBranch(HDC,CRect &rect,INT_PTR index);\r
+       void DrawGraph(HDC,CRect &rect,INT_PTR index);\r
+\r
+       BOOL GetShortName(CString ref, CString &shortname,CString prefix);\r
+       void paintGraphLane(HDC hdc,int laneHeight, int type, int x1, int x2,\r
+                                      const COLORREF& col,int top) ; \r
+       void DrawLine(HDC hdc, int x1, int y1, int x2, int y2){::MoveToEx(hdc,x1,y1,NULL);::LineTo(hdc,x2,y2);}\r
+\r
+\r
+       BOOL IsEntryInDateRange(int i);\r
+\r
+\r
+\r
+       bool                            m_bFilterWithRegex;\r
+\r
+       \r
+       CXPTheme                        m_Theme;\r
+       BOOL                            m_bVista;\r
+       \r
+       HICON                           m_hModifiedIcon;\r
+       HICON                           m_hReplacedIcon;\r
+       HICON                           m_hAddedIcon;\r
+       HICON                           m_hDeletedIcon;\r
+\r
+       HFONT                           m_boldFont;\r
+\r
+       CRegDWORD                       m_regMaxBugIDColWidth;\r
+       int                                     m_nSearchIndex;\r
+       \r
+       CALLBACK_PROCESS    *m_ProcCallBack;\r
+       void                            *m_ProcData;\r
+       CStoreSelection*        m_pStoreSelection;\r
+       MAP_HASH_NAME           m_HashMap;\r
+};\r
+\r
+\r
index dbff8df..516cb47 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "stdafx.h"
 #include "TortoiseProc.h"
-#include "GitLogList.h"
+#include "GitLogListBase.h"
 #include "GitRev.h"
 //#include "VssStyle.h"
 #include "IconMenu.h"
index 0a54a46..dd3df54 100644 (file)
@@ -22,6 +22,7 @@
 #include "GitStatus.h"\r
 #include "ILogReceiver.h"\r
 #include "lanes.h"\r
+#include <set> \r
 \r
 class CLogDlg;\r
 \r
index 128b60b..5e3421a 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\explorer.ico"\r
+                               RelativePath=".\explorer.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\explorer.ico"\r
+                               RelativePath="..\Resources\explorer.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\newfolder.ico"\r
+                               RelativePath=".\newfolder.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\newfolder.ico"\r
+                               RelativePath="..\Resources\newfolder.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\open.ico"\r
+                               RelativePath=".\open.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\open.ico"\r
+                               RelativePath="..\Resources\open.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\save.ico"\r
+                               RelativePath=".\save.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\save.ico"\r
+                               RelativePath="..\Resources\save.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\saveas.ico"\r
+                               RelativePath=".\saveas.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\saveas.ico"\r
+                               RelativePath="..\Resources\saveas.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\up.ico"\r
+                               RelativePath=".\up.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\up.ico"\r
+                               RelativePath="..\Resources\up.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                Name="Log"\r
                                >\r
                                <File\r
-                                       RelativePath=".\GitLogList.cpp"\r
+                                       RelativePath=".\GitLogList.h"\r
                                        >\r
                                </File>\r
                                <File\r
-                                       RelativePath=".\GitLogList.h"\r
+                                       RelativePath=".\GitLogListAction.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\GitLogListBase.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\GitLogListBase.h"\r
                                        >\r
                                </File>\r
                                <File\r
                                </File>\r
                        </Filter>\r
                        <Filter\r
-                               Name="Switch"\r
-                               >\r
-                               <File\r
-                                       RelativePath=".\GitSwitchDlg.cpp"\r
-                                       >\r
-                               </File>\r
-                               <File\r
-                                       RelativePath=".\GitSwitchDlg.h"\r
-                                       >\r
-                               </File>\r
-                               <File\r
-                                       RelativePath=".\Commands\SwitchCommand.cpp"\r
-                                       >\r
-                               </File>\r
-                               <File\r
-                                       RelativePath=".\Commands\SwitchCommand.h"\r
-                                       >\r
-                               </File>\r
-                       </Filter>\r
-                       <Filter\r
                                Name="Clone"\r
                                >\r
                                <File\r
                                        >\r
                                </File>\r
                        </Filter>\r
+                       <Filter\r
+                               Name="Switch"\r
+                               >\r
+                               <File\r
+                                       RelativePath=".\GitSwitchDlg.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\GitSwitchDlg.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\Commands\SwitchCommand.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\Commands\SwitchCommand.h"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
                </Filter>\r
                <Filter\r
                        Name="Utility Dialogs"\r