1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2012 - TortoiseGit
4 // Copyright (C) 2005-2007 Marco Costalba
5 // Copyright (C) 2011-2012 - Sven Strickroth <email@cs-ware.de>
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software Foundation,
19 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 // GitLogList.cpp : implementation file
25 #include "GitLogListBase.h"
27 //#include "VssStyle.h"
32 #include "GITProgressDlg.h"
33 #include "ProgressDlg.h"
34 //#include "RepositoryBrowser.h"
35 //#include "CopyDlg.h"
36 //#include "StatGraphDlg.h"
38 #include "MessageBox.h"
40 #include "LoglistUtils.h"
41 #include "PathUtils.h"
42 #include "StringUtils.h"
43 #include "UnicodeUtils.h"
45 //#include "GitInfo.h"
46 //#include "GitDiff.h"
48 //#include "RevisionRangeDlg.h"
49 //#include "BrowseFolder.h"
50 //#include "BlameDlg.h"
52 //#include "GitHelpers.h"
53 #include "GitStatus.h"
54 //#include "LogDlgHelper.h"
55 //#include "CachedLogInfo.h"
56 //#include "RepositoryInfo.h"
57 //#include "EditPropertiesDlg.h"
58 #include "FileDiffDlg.h"
59 #include "..\\TortoiseShell\\Resource.h"
63 const UINT
CGitLogListBase::m_FindDialogMessage
= RegisterWindowMessage(FINDMSGSTRING
);
64 const UINT
CGitLogListBase::m_ScrollToMessage
= RegisterWindowMessage(_T("TORTOISEGIT_LOG_SCROLLTO"));
66 IMPLEMENT_DYNAMIC(CGitLogListBase
, CHintListCtrl
)
68 CGitLogListBase::CGitLogListBase():CHintListCtrl()
69 ,m_regMaxBugIDColWidth(_T("Software\\TortoiseGit\\MaxBugIDColWidth"), 200)
71 ,m_bNoDispUpdates(FALSE
)
72 , m_bThreadRunning(FALSE
)
73 , m_bStrictStopped(false)
74 , m_pStoreSelection(NULL
)
75 , m_SelectedFilters(LOGFILTER_ALL
)
77 , m_logEntries(&m_LogCache
)
79 , m_ColumnManager(this)
80 , m_dwDefaultColumns(0)
81 , m_arShownList(&m_critSec
)
83 , m_bNoHightlightHead(FALSE
)
85 // use the default GUI font, create a copy of it and
86 // change the copy to BOLD (leave the rest of the font
88 HFONT hFont
= (HFONT
)GetStockObject(DEFAULT_GUI_FONT
);
90 GetObject(hFont
, sizeof(LOGFONT
), &lf
);
91 lf
.lfWeight
= FW_BOLD
;
92 m_boldFont
= CreateFontIndirect(&lf
);
94 m_bShowBugtraqColumn
=false;
96 m_IsIDReplaceAction
=FALSE
;
98 this->m_critSec
.Init();
99 m_wcRev
.m_CommitHash
.Empty();
100 m_wcRev
.GetSubject() = CString(MAKEINTRESOURCE(IDS_LOG_WORKINGDIRCHANGES
));
101 m_wcRev
.m_ParentHash
.clear();
102 m_wcRev
.m_Mark
=_T('-');
103 m_wcRev
.m_IsUpdateing
=FALSE
;
104 m_wcRev
.m_IsFull
= TRUE
;
106 m_hModifiedIcon
= (HICON
)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ACTIONMODIFIED
), IMAGE_ICON
, 0, 0, LR_DEFAULTSIZE
);
107 m_hReplacedIcon
= (HICON
)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ACTIONREPLACED
), IMAGE_ICON
, 0, 0, LR_DEFAULTSIZE
);
108 m_hAddedIcon
= (HICON
)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ACTIONADDED
), IMAGE_ICON
, 0, 0, LR_DEFAULTSIZE
);
109 m_hDeletedIcon
= (HICON
)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ACTIONDELETED
), IMAGE_ICON
, 0, 0, LR_DEFAULTSIZE
);
110 m_hFetchIcon
= (HICON
)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ACTIONFETCHING
), IMAGE_ICON
, 0, 0, LR_DEFAULTSIZE
);
112 m_bFilterWithRegex
= !!CRegDWORD(_T("Software\\TortoiseGit\\UseRegexFilter"), TRUE
);
114 g_Git
.GetMapHashToFriendName(m_HashMap
);
115 if (CTGitPath(g_Git
.m_CurrentDir
).HasAdminDir())
117 m_CurrentBranch
=g_Git
.GetCurrentBranch();
119 m_HeadHash
=g_Git
.GetHash(_T("HEAD"));
124 MessageBox(_T("Could not get HEAD hash. Quitting...\nlibgit reports:\n") + err
, _T("TortoiseGit"), MB_ICONERROR
);
133 m_LoadingThread
= NULL
;
135 InterlockedExchange(&m_bExitThread
,FALSE
);
136 m_IsOldFirst
= FALSE
;
137 m_IsRebaseReplaceGraph
= FALSE
;
140 for(int i
=0;i
<Lanes::COLORS_NUM
;i
++)
142 m_LineColors
[i
] = m_Colors
.GetColor((CColors::Colors
)(CColors::BranchLine1
+i
));
144 // get short/long datetime setting from registry
145 DWORD RegUseShortDateFormat
= CRegDWORD(_T("Software\\TortoiseGit\\LogDateFormat"), TRUE
);
146 if ( RegUseShortDateFormat
)
148 m_DateFormat
= DATE_SHORTDATE
;
152 m_DateFormat
= DATE_LONGDATE
;
154 // get relative time display setting from registry
155 DWORD regRelativeTimes
= CRegDWORD(_T("Software\\TortoiseGit\\RelativeTimes"), FALSE
);
156 m_bRelativeTimes
= (regRelativeTimes
!= 0);
157 m_ContextMenuMask
= 0xFFFFFFFFFFFFFFFF;
159 m_ContextMenuMask
&= ~GetContextMenuBit(ID_REBASE_PICK
);
160 m_ContextMenuMask
&= ~GetContextMenuBit(ID_REBASE_SQUASH
);
161 m_ContextMenuMask
&= ~GetContextMenuBit(ID_REBASE_EDIT
);
162 m_ContextMenuMask
&= ~GetContextMenuBit(ID_REBASE_SKIP
);
163 m_ContextMenuMask
&= ~GetContextMenuBit(ID_LOG
);
164 m_ContextMenuMask
&= ~GetContextMenuBit(ID_BLAME
);
166 m_ColumnRegKey
=_T("log");
168 m_AsyncThreadExit
= FALSE
;
169 m_AsyncDiffEvent
= ::CreateEvent(NULL
,FALSE
,TRUE
,NULL
);
170 m_AsynDiffListLock
.Init();
172 m_DiffingThread
= AfxBeginThread(AsyncThread
, this, THREAD_PRIORITY_BELOW_NORMAL
);
173 if (m_DiffingThread
==NULL
)
175 CMessageBox::Show(NULL
, IDS_ERR_THREADSTARTFAILED
, IDS_APPNAME
, MB_OK
| MB_ICONERROR
);
181 int CGitLogListBase::AsyncDiffThread()
183 m_AsyncThreadExited
= false;
184 while(!m_AsyncThreadExit
)
186 ::WaitForSingleObject(m_AsyncDiffEvent
, INFINITE
);
189 while(!m_AsyncThreadExit
&& !m_AsynDiffList
.empty())
191 m_AsynDiffListLock
.Lock();
192 pRev
= m_AsynDiffList
.back();
193 m_AsynDiffList
.pop_back();
194 m_AsynDiffListLock
.Unlock();
196 if( pRev
->m_CommitHash
.IsEmpty() )
198 if(pRev
->m_IsDiffFiles
)
201 pRev
->GetFiles(this).Clear();
202 pRev
->m_ParentHash
.clear();
203 pRev
->m_ParentHash
.push_back(m_HeadHash
);
204 if(g_Git
.IsInitRepos())
206 g_Git
.GetInitAddList(pRev
->GetFiles(this));
211 g_Git
.GetCommitDiffList(pRev
->m_CommitHash
.ToString(),this->m_HeadHash
.ToString(), pRev
->GetFiles(this));
213 pRev
->GetAction(this) = 0;
215 for(int j
=0;j
< pRev
->GetFiles(this).GetCount();j
++)
216 pRev
->GetAction(this) |= pRev
->GetFiles(this)[j
].m_Action
;
218 pRev
->GetUnRevFiles().FillUnRev(CTGitPath::LOGACTIONS_UNVER
);
220 InterlockedExchange(&pRev
->m_IsDiffFiles
, TRUE
);
221 InterlockedExchange(&pRev
->m_IsFull
, TRUE
);
223 pRev
->GetBody().Format(IDS_FILESCHANGES
, pRev
->GetFiles(this).GetCount());
224 ::PostMessage(m_hWnd
,MSG_LOADED
,(WPARAM
)0,0);
225 this->GetParent()->PostMessage(WM_COMMAND
, MSG_FETCHED_DIFF
, 0);
228 if(!pRev
->CheckAndDiff())
229 { // fetch change file list
230 for(int i
=GetTopIndex(); !m_AsyncThreadExit
&& i
<= GetTopIndex()+GetCountPerPage(); i
++)
232 if(i
< m_arShownList
.GetCount())
234 GitRev
* data
= (GitRev
*)m_arShownList
.SafeGetAt(i
);
235 if(data
->m_CommitHash
== pRev
->m_CommitHash
)
237 ::PostMessage(m_hWnd
,MSG_LOADED
,(WPARAM
)i
,0);
243 if(!m_AsyncThreadExit
&& GetSelectedCount() == 1)
245 POSITION pos
= GetFirstSelectedItemPosition();
246 int nItem
= GetNextSelectedItem(pos
);
250 GitRev
* data
= (GitRev
*)m_arShownList
[nItem
];
252 if(data
->m_CommitHash
== pRev
->m_CommitHash
)
254 this->GetParent()->PostMessage(WM_COMMAND
, MSG_FETCHED_DIFF
, 0);
261 m_AsyncThreadExited
= true;
264 void CGitLogListBase::hideFromContextMenu(unsigned __int64 hideMask
, bool exclusivelyShow
)
268 m_ContextMenuMask
&= hideMask
;
272 m_ContextMenuMask
&= ~hideMask
;
276 CGitLogListBase::~CGitLogListBase()
278 InterlockedExchange(&m_bNoDispUpdates
, TRUE
);
279 this->m_arShownList
.SafeRemoveAll();
281 DestroyIcon(m_hModifiedIcon
);
282 DestroyIcon(m_hReplacedIcon
);
283 DestroyIcon(m_hAddedIcon
);
284 DestroyIcon(m_hDeletedIcon
);
285 m_logEntries
.ClearAll();
288 DeleteObject(m_boldFont
);
290 if ( m_pStoreSelection
)
292 delete m_pStoreSelection
;
293 m_pStoreSelection
= NULL
;
296 SafeTerminateThread();
297 SafeTerminateAsyncDiffThread();
300 CloseHandle(m_AsyncDiffEvent
);
304 BEGIN_MESSAGE_MAP(CGitLogListBase
, CHintListCtrl
)
305 ON_REGISTERED_MESSAGE(m_FindDialogMessage
, OnFindDialogMessage
)
306 ON_REGISTERED_MESSAGE(m_ScrollToMessage
, OnScrollToMessage
)
307 ON_NOTIFY_REFLECT(NM_CUSTOMDRAW
, OnNMCustomdrawLoglist
)
308 ON_NOTIFY_REFLECT(LVN_GETDISPINFO
, OnLvnGetdispinfoLoglist
)
310 ON_NOTIFY_REFLECT(NM_DBLCLK
, OnNMDblclkLoglist
)
311 ON_NOTIFY_REFLECT(LVN_ODFINDITEM
,OnLvnOdfinditemLoglist
)
314 ON_MESSAGE(MSG_LOADED
,OnLoad
)
316 ON_WM_MEASUREITEM_REFLECT()
317 ON_NOTIFY(HDN_BEGINTRACKA
, 0, OnHdnBegintrack
)
318 ON_NOTIFY(HDN_BEGINTRACKW
, 0, OnHdnBegintrack
)
319 ON_NOTIFY(HDN_ITEMCHANGINGA
, 0, OnHdnItemchanging
)
320 ON_NOTIFY(HDN_ITEMCHANGINGW
, 0, OnHdnItemchanging
)
321 ON_NOTIFY(HDN_ENDTRACK
, 0, OnColumnResized
)
322 ON_NOTIFY(HDN_ENDDRAG
, 0, OnColumnMoved
)
325 void CGitLogListBase::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct
)
327 //if (m_nRowHeight>0)
329 lpMeasureItemStruct
->itemHeight
= 50;
333 int CGitLogListBase:: OnCreate(LPCREATESTRUCT lpCreateStruct
)
336 return CHintListCtrl::OnCreate(lpCreateStruct
);
339 void CGitLogListBase::PreSubclassWindow()
341 SetExtendedStyle(LVS_EX_FULLROWSELECT
| LVS_EX_SUBITEMIMAGES
);
342 // load the icons for the action columns
343 // m_Theme.Open(m_hWnd, L"ListView");
344 SetWindowTheme(m_hWnd
, L
"Explorer", NULL
);
345 CHintListCtrl::PreSubclassWindow();
348 void CGitLogListBase::InsertGitColumn()
352 CRegDWORD
regFullRowSelect(_T("Software\\TortoiseGit\\FullRowSelect"), TRUE
);
353 DWORD exStyle
= LVS_EX_HEADERDRAGDROP
| LVS_EX_DOUBLEBUFFER
| LVS_EX_INFOTIP
| LVS_EX_SUBITEMIMAGES
;
354 if (DWORD(regFullRowSelect
))
355 exStyle
|= LVS_EX_FULLROWSELECT
;
356 SetExtendedStyle(exStyle
);
358 UpdateProjectProperties();
360 static UINT normal
[] =
372 IDS_LOG_COMMIT_EMAIL
,
393 m_dwDefaultColumns
= GIT_LOG_GRAPH
|GIT_LOG_ACTIONS
|GIT_LOG_MESSAGE
|GIT_LOG_AUTHOR
|GIT_LOG_DATE
;
395 DWORD hideColumns
= 0;
396 if(this->m_IsRebaseReplaceGraph
)
398 hideColumns
|= GIT_LOG_GRAPH
;
399 m_dwDefaultColumns
|= GIT_LOG_REBASE
;
403 hideColumns
|= GIT_LOG_REBASE
;
406 if(this->m_IsIDReplaceAction
)
408 hideColumns
|= GIT_LOG_ACTIONS
;
409 m_dwDefaultColumns
|= GIT_LOG_ID
;
410 m_dwDefaultColumns
|= GIT_LOG_HASH
;
414 hideColumns
|= GIT_LOG_ID
;
416 if(this->m_bShowBugtraqColumn
)
418 m_dwDefaultColumns
|= GIT_LOGLIST_BUG
;
422 hideColumns
|= GIT_LOGLIST_BUG
;
426 m_ColumnManager
.SetNames(normal
, _countof(normal
));
427 m_ColumnManager
.ReadSettings(m_dwDefaultColumns
, hideColumns
, m_ColumnRegKey
+_T("loglist"), _countof(normal
), with
);
434 * Resizes all columns in a list control to values in registry.
436 void CGitLogListBase::ResizeAllListCtrlCols()
438 // column max and min widths to allow
439 static const int nMinimumWidth
= 10;
440 static const int nMaximumWidth
= 1000;
441 CHeaderCtrl
* pHdrCtrl
= (CHeaderCtrl
*)(GetDlgItem(0));
444 int numcols
= pHdrCtrl
->GetItemCount();
445 for (int col
= 0; col
< numcols
; col
++)
447 // get width for this col last time from registry
449 regentry
.Format( _T("Software\\TortoiseGit\\%s\\ColWidth%d"),m_ColumnRegKey
, col
);
450 CRegDWORD
regwidth(regentry
, 0);
454 // no saved value, setup sensible defaults
455 if (col
== this->LOGLIST_MESSAGE
)
457 cx
= LOGLIST_MESSAGE_MIN
;
461 cx
= ICONITEMBORDER
+16*4;
464 if (cx
< nMinimumWidth
)
468 else if (cx
> nMaximumWidth
)
473 SetColumnWidth(col
, cx
);
480 BOOL
CGitLogListBase::GetShortName(CString ref
, CString
&shortname
,CString prefix
)
482 //TRACE(_T("%s %s\r\n"),ref,prefix);
483 if(ref
.Left(prefix
.GetLength()) == prefix
)
485 shortname
= ref
.Right(ref
.GetLength()-prefix
.GetLength());
486 if(shortname
.Right(3)==_T("^{}"))
487 shortname
=shortname
.Left(shortname
.GetLength()-3);
493 void CGitLogListBase::FillBackGround(HDC hdc
, DWORD_PTR Index
, CRect
&rect
)
496 SecureZeroMemory(&rItem
, sizeof(LVITEM
));
497 rItem
.mask
= LVIF_STATE
;
498 rItem
.iItem
= (int)Index
;
499 rItem
.stateMask
= LVIS_SELECTED
| LVIS_FOCUSED
;
502 GitRev
* pLogEntry
= (GitRev
*)m_arShownList
.SafeGetAt(Index
);
505 if (!(rItem
.state
& LVIS_SELECTED
))
507 if(pLogEntry
->GetAction(this)&CTGitPath::LOGACTIONS_REBASE_SQUASH
)
508 brush
= ::CreateSolidBrush(RGB(156,156,156));
509 else if(pLogEntry
->GetAction(this)&CTGitPath::LOGACTIONS_REBASE_EDIT
)
510 brush
= ::CreateSolidBrush(RGB(200,200,128));
512 else if (!(IsAppThemed() && SysInfo::Instance().IsVistaOrLater()))
514 if (rItem
.state
& LVIS_SELECTED
)
516 if (::GetFocus() == m_hWnd
)
517 brush
= ::CreateSolidBrush(::GetSysColor(COLOR_HIGHLIGHT
));
519 brush
= ::CreateSolidBrush(::GetSysColor(COLOR_BTNFACE
));
525 ::FillRect(hdc
, &rect
, brush
);
526 ::DeleteObject(brush
);
530 void CGitLogListBase::DrawTagBranch(HDC hdc
,CRect
&rect
,INT_PTR index
)
532 GitRev
* data
= (GitRev
*)m_arShownList
.SafeGetAt(index
);
535 SecureZeroMemory(&rItem
, sizeof(LVITEM
));
536 rItem
.mask
= LVIF_STATE
;
537 rItem
.iItem
= (int)index
;
538 rItem
.stateMask
= LVIS_SELECTED
| LVIS_FOCUSED
;
544 HTHEME hTheme
= NULL
;
545 if (IsAppThemed() && SysInfo::Instance().IsVistaOrLater())
546 hTheme
= OpenThemeData(m_hWnd
, L
"Explorer::ListView;ListView");
548 for(unsigned int i
=0;i
<m_HashMap
[data
->m_CommitHash
].size();i
++)
551 str
=m_HashMap
[data
->m_CommitHash
][i
];
558 //Determine label color
559 if(GetShortName(str
,shortname
,_T("refs/heads/")))
561 if( shortname
== m_CurrentBranch
)
562 colRef
= m_Colors
.GetColor(CColors::CurrentBranch
);
564 colRef
= m_Colors
.GetColor(CColors::LocalBranch
);
567 else if(GetShortName(str
,shortname
,_T("refs/remotes/")))
569 colRef
= m_Colors
.GetColor(CColors::RemoteBranch
);
571 else if(GetShortName(str
,shortname
,_T("refs/tags/")))
573 colRef
= m_Colors
.GetColor(CColors::Tag
);
575 else if(GetShortName(str
,shortname
,_T("refs/stash")))
577 colRef
= m_Colors
.GetColor(CColors::Stash
);
578 shortname
=_T("stash");
580 else if(GetShortName(str
,shortname
,_T("refs/bisect/")))
582 if(shortname
.Find(_T("good")) == 0)
584 colRef
= m_Colors
.GetColor(CColors::BisectGood
);
585 shortname
= _T("good");
588 if(shortname
.Find(_T("bad")) == 0)
590 colRef
= m_Colors
.GetColor(CColors::BisectBad
);
591 shortname
= _T("bad");
595 //When row selected, ajust label color
596 if (!(IsAppThemed() && SysInfo::Instance().IsVistaOrLater()))
597 if (rItem
.state
& LVIS_SELECTED
)
598 colRef
= CColors::MixColors(colRef
, ::GetSysColor(COLOR_HIGHLIGHT
), 150);
600 brush
= ::CreateSolidBrush(colRef
);
602 if(!shortname
.IsEmpty() && (rt
.left
<rect
.right
) )
605 memset(&size
,0,sizeof(SIZE
));
606 GetTextExtentPoint32(hdc
, shortname
,shortname
.GetLength(),&size
);
608 rt
.SetRect(rt
.left
,rt
.top
,rt
.left
+size
.cx
,rt
.bottom
);
611 int textpos
= DT_CENTER
;
613 if(rt
.right
> rect
.right
)
615 rt
.right
= rect
.right
;
619 //Fill interior of ref label
620 ::FillRect(hdc
, &rt
, brush
);
626 W_Dc
.Draw3dRect(rectEdge
, m_Colors
.Lighten(colRef
,100), m_Colors
.Darken(colRef
,100));
627 rectEdge
.DeflateRect(1,1);
628 W_Dc
.Draw3dRect(rectEdge
, m_Colors
.Lighten(colRef
,50), m_Colors
.Darken(colRef
,50));
630 //Draw text inside label
631 if (IsAppThemed() && SysInfo::Instance().IsVistaOrLater())
633 int txtState
= LISS_NORMAL
;
634 if (rItem
.state
& LVIS_SELECTED
)
635 txtState
= LISS_SELECTED
;
637 DrawThemeText(hTheme
,hdc
, LVP_LISTITEM
, txtState
, shortname
, -1, textpos
| DT_SINGLELINE
| DT_VCENTER
, 0, &rt
);
641 W_Dc
.SetBkMode(TRANSPARENT
);
642 if (rItem
.state
& LVIS_SELECTED
)
644 COLORREF clrNew
= ::GetSysColor(COLOR_HIGHLIGHTTEXT
);
645 COLORREF clrOld
= ::SetTextColor(hdc
,clrNew
);
646 ::DrawText(hdc
,shortname
,shortname
.GetLength(),&rt
,textpos
| DT_SINGLELINE
| DT_VCENTER
);
647 ::SetTextColor(hdc
,clrOld
);
651 ::DrawText(hdc
,shortname
,shortname
.GetLength(),&rt
,textpos
| DT_SINGLELINE
| DT_VCENTER
);
655 //::MoveToEx(hdc,rt.left,rt.top,NULL);
656 //::LineTo(hdc,rt.right,rt.top);
657 //::LineTo(hdc,rt.right,rt.bottom);
658 //::LineTo(hdc,rt.left,rt.bottom);
659 //::LineTo(hdc,rt.left,rt.top);
664 ::DeleteObject(brush
);
668 if (IsAppThemed() && SysInfo::Instance().IsVistaOrLater())
670 int txtState
= LISS_NORMAL
;
671 if (rItem
.state
& LVIS_SELECTED
)
672 txtState
= LISS_SELECTED
;
674 DrawThemeText(hTheme
,hdc
, LVP_LISTITEM
, txtState
, data
->GetSubject(), -1, DT_NOPREFIX
| DT_LEFT
| DT_SINGLELINE
| DT_VCENTER
| DT_END_ELLIPSIS
, 0, &rt
);
678 if (rItem
.state
& LVIS_SELECTED
)
680 COLORREF clrOld
= ::SetTextColor(hdc
,::GetSysColor(COLOR_HIGHLIGHTTEXT
));
681 ::DrawText(hdc
,data
->GetSubject(),data
->GetSubject().GetLength(),&rt
,DT_NOPREFIX
| DT_LEFT
| DT_SINGLELINE
| DT_VCENTER
| DT_END_ELLIPSIS
);
682 ::SetTextColor(hdc
,clrOld
);
686 ::DrawText(hdc
,data
->GetSubject(),data
->GetSubject().GetLength(),&rt
,DT_NOPREFIX
| DT_LEFT
| DT_SINGLELINE
| DT_VCENTER
| DT_END_ELLIPSIS
);
691 CloseThemeData(hTheme
);
696 static COLORREF
blend(const COLORREF
& col1
, const COLORREF
& col2
, int amount
= 128) {
698 // Returns ((256 - amount)*col1 + amount*col2) / 256;
699 return RGB(((256 - amount
)*GetRValue(col1
) + amount
*GetRValue(col2
) ) / 256,
700 ((256 - amount
)*GetGValue(col1
) + amount
*GetGValue(col2
) ) / 256,
701 ((256 - amount
)*GetBValue(col1
) + amount
*GetBValue(col2
) ) / 256);
704 Gdiplus::Color
GetGdiColor(COLORREF col
)
706 return Gdiplus::Color(GetRValue(col
),GetGValue(col
),GetBValue(col
));
708 void CGitLogListBase::paintGraphLane(HDC hdc
, int laneHeight
,int type
, int x1
, int x2
,
709 const COLORREF
& col
,const COLORREF
& activeColor
, int top
712 int h
= laneHeight
/ 2;
713 int m
= (x1
+ x2
) / 2;
714 int r
= (x2
- x1
) / 3;
717 #define P_CENTER m , h+top
718 #define P_0 x2, h+top
719 #define P_90 m , 0+top-1
720 #define P_180 x1, h+top
721 #define P_270 m , 2 * h+top +1
722 #define R_CENTER m - r, h - r+top, d, d
725 #define DELTA_UR_B 2*(x1 - m), 2*h +top
726 #define DELTA_UR_E 0*16, 90*16 +top // -,
728 #define DELTA_DR_B 2*(x1 - m), 2*-h +top
729 #define DELTA_DR_E 270*16, 90*16 +top // -'
731 #define DELTA_UL_B 2*(x2 - m), 2*h +top
732 #define DELTA_UL_E 90*16, 90*16 +top // ,-
734 #define DELTA_DL_B 2*(x2 - m),2*-h +top
735 #define DELTA_DL_E 180*16, 90*16 // '-
737 #define CENTER_UR x1, 2*h, 225
738 #define CENTER_DR x1, 0 , 135
739 #define CENTER_UL x2, 2*h, 315
740 #define CENTER_DL x2, 0 , 45
743 Gdiplus::Graphics
graphics( hdc
);
745 graphics
.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias
);
754 Gdiplus::LinearGradientBrush
gradient(
755 Gdiplus::Point(x1
-2, h
+top
-2),
756 Gdiplus::Point(P_270
),
757 GetGdiColor(activeColor
),GetGdiColor(col
));
760 Gdiplus::Pen
mypen(&gradient
,2);
761 //Gdiplus::Pen mypen(Gdiplus::Color(0,0,0),2);
763 //graphics.DrawRectangle(&mypen,x1-(x2-x1)/2,top+h, x2-x1,laneHeight);
764 graphics
.DrawArc(&mypen
,x1
-(x2
-x1
)/2-1,top
+h
-1, x2
-x1
,laneHeight
,270,90);
765 //graphics.DrawLine(&mypen,x1-1,h+top,P_270);
772 Gdiplus::LinearGradientBrush
gradient(
773 Gdiplus::Point(P_270
),
774 Gdiplus::Point(x2
+1, h
+top
-1),
775 GetGdiColor(col
),GetGdiColor(activeColor
));
778 Gdiplus::Pen
mypen(&gradient
,2);
779 //Gdiplus::Pen mypen(Gdiplus::Color(0,0,0),2);
781 //graphics.DrawRectangle(&mypen,x1-(x2-x1)/2,top+h, x2-x1,laneHeight);
782 graphics
.DrawArc(&mypen
,x1
+(x2
-x1
)/2,top
+h
-1, x2
-x1
,laneHeight
,180,90);
783 //graphics.DrawLine(&mypen,x1-1,h+top,P_270);
792 Gdiplus::LinearGradientBrush
gradient(
793 Gdiplus::Point(x1
-2, h
+top
-2),
794 Gdiplus::Point(P_90
),
795 GetGdiColor(activeColor
),GetGdiColor(col
));
797 Gdiplus::Pen
mypen(&gradient
,2);
799 graphics
.DrawArc(&mypen
,x1
-(x2
-x1
)/2-1,top
-h
-1, x2
-x1
,laneHeight
,0,90);
802 QConicalGradient
gradient(CENTER_DR
);
803 gradient
.setColorAt(0.375, activeCol
);
804 gradient
.setColorAt(0.625, col
);
805 myPen
.setBrush(gradient
);
807 p
->drawArc(P_CENTER
, DELTA_DR
);
816 //static QPen myPen(Qt::black, 2); // fast path here
818 pen
.CreatePen(PS_SOLID
,2,col
);
819 //myPen.setColor(col);
820 HPEN oldpen
=(HPEN
)::SelectObject(hdc
,(HPEN
)pen
);
822 Gdiplus::Pen
myPen(GetGdiColor(col
),2);
824 graphics
.SetSmoothingMode(Gdiplus::SmoothingModeNone
);
831 case Lanes::NOT_ACTIVE
:
832 case Lanes::MERGE_FORK
:
833 case Lanes::MERGE_FORK_R
:
834 case Lanes::MERGE_FORK_L
:
839 //DrawLine(hdc,P_90,P_270);
840 graphics
.DrawLine(&myPen
,P_90
,P_270
);
841 //p->drawLine(P_90, P_270);
845 //DrawLine(hdc,P_CENTER,P_270);
846 graphics
.DrawLine(&myPen
,P_CENTER
,P_270
);
847 //p->drawLine(P_CENTER, P_270);
851 case Lanes::BOUNDARY
:
852 case Lanes::BOUNDARY_C
:
853 case Lanes::BOUNDARY_R
:
854 case Lanes::BOUNDARY_L
:
855 //DrawLine(hdc,P_90, P_CENTER);
856 graphics
.DrawLine(&myPen
,P_90
,P_CENTER
);
857 //p->drawLine(P_90, P_CENTER);
863 myPen
.SetColor(GetGdiColor(activeColor
));
867 case Lanes::MERGE_FORK
:
872 case Lanes::CROSS_EMPTY
:
873 case Lanes::BOUNDARY_C
:
874 //DrawLine(hdc,P_180,P_0);
875 graphics
.DrawLine(&myPen
,P_180
,P_0
);
876 //p->drawLine(P_180, P_0);
878 case Lanes::MERGE_FORK_R
:
879 case Lanes::BOUNDARY_R
:
880 //DrawLine(hdc,P_180,P_CENTER);
881 graphics
.DrawLine(&myPen
,P_180
,P_CENTER
);
882 //p->drawLine(P_180, P_CENTER);
884 case Lanes::MERGE_FORK_L
:
887 case Lanes::BOUNDARY_L
:
888 //DrawLine(hdc,P_CENTER,P_0);
889 graphics
.DrawLine(&myPen
,P_CENTER
,P_0
);
890 //p->drawLine(P_CENTER, P_0);
896 graphics
.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias
);
899 brush
.CreateSolidBrush(col
);
900 HBRUSH oldbrush
=(HBRUSH
)::SelectObject(hdc
,(HBRUSH
)brush
);
902 Gdiplus::SolidBrush
myBrush(GetGdiColor(col
));
903 // center symbol, e.g. rect or ellipse
909 //p->setPen(Qt::NoPen);
911 graphics
.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias
);
912 graphics
.FillEllipse(&myBrush
, R_CENTER
);
913 //p->drawEllipse(R_CENTER);
915 case Lanes::MERGE_FORK
:
916 case Lanes::MERGE_FORK_R
:
917 case Lanes::MERGE_FORK_L
:
918 //p->setPen(Qt::NoPen);
920 //p->drawRect(R_CENTER);
921 graphics
.SetSmoothingMode(Gdiplus::SmoothingModeNone
);
922 graphics
.FillRectangle(&myBrush
, R_CENTER
);
924 case Lanes::UNAPPLIED
:
926 //p->setPen(Qt::NoPen);
927 //p->setBrush(Qt::red);
928 //p->drawRect(m - r, h - 1, d, 2);
929 graphics
.SetSmoothingMode(Gdiplus::SmoothingModeNone
);
930 graphics
.FillRectangle(&myBrush
,m
-r
,h
-1,d
,2);
934 //p->setPen(Qt::NoPen);
935 //p->setBrush(DARK_GREEN);
936 //p->drawRect(m - r, h - 1, d, 2);
937 //p->drawRect(m - 1, h - r, 2, d);
938 graphics
.SetSmoothingMode(Gdiplus::SmoothingModeNone
);
939 graphics
.FillRectangle(&myBrush
,m
-r
,h
-1,d
,2);
940 graphics
.FillRectangle(&myBrush
,m
-1,h
-r
,2,d
);
942 case Lanes::BOUNDARY
:
944 //p->drawEllipse(R_CENTER);
945 graphics
.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias
);
946 graphics
.DrawEllipse(&myPen
, R_CENTER
);
948 case Lanes::BOUNDARY_C
:
949 case Lanes::BOUNDARY_R
:
950 case Lanes::BOUNDARY_L
:
952 //p->drawRect(R_CENTER);
953 graphics
.SetSmoothingMode(Gdiplus::SmoothingModeNone
);
954 graphics
.FillRectangle(&myBrush
,R_CENTER
);
960 ::SelectObject(hdc
,oldpen
);
961 ::SelectObject(hdc
,oldbrush
);
970 void CGitLogListBase::DrawGraph(HDC hdc
,CRect
&rect
,INT_PTR index
)
974 GitRev
* data
= (GitRev
*)m_arShownList
.SafeGetAt(index
);
975 if(data
->m_CommitHash
.IsEmpty())
980 SecureZeroMemory(&rItem
, sizeof(LVITEM
));
981 rItem
.mask
= LVIF_STATE
;
982 rItem
.iItem
= (int)index
;
983 rItem
.stateMask
= LVIS_SELECTED
| LVIS_FOCUSED
;
986 // p->translate(QPoint(opt.rect.left(), opt.rect.top()));
988 if (data
->m_Lanes
.empty())
989 m_logEntries
.setLane(data
->m_CommitHash
);
991 std::vector
<int>& lanes
=data
->m_Lanes
;
992 size_t laneNum
= lanes
.size();
994 for (UINT i
= 0; i
< laneNum
; i
++)
995 if (Lanes::isMerge(lanes
[i
])) {
1001 int maxWidth
= rect
.Width();
1002 int lw
= 3 * rect
.Height() / 4; //laneWidth()
1004 COLORREF activeColor
= m_LineColors
[activeLane
% Lanes::COLORS_NUM
];
1005 //if (opt.state & QStyle::State_Selected)
1006 // activeColor = blend(activeColor, opt.palette.highlightedText().color(), 208);
1008 for (unsigned int i
= 0; i
< laneNum
&& x2
< maxWidth
; i
++)
1015 if (ln
== Lanes::EMPTY
)
1018 COLORREF color
= i
== activeLane
? activeColor
: m_LineColors
[i
% Lanes::COLORS_NUM
];
1019 paintGraphLane(hdc
, rect
.Height(),ln
, x1
+rect
.left
, x2
+rect
.left
, color
,activeColor
, rect
.top
);
1023 for (UINT i
= 0; i
< laneNum
&& x2
< maxWidth
; i
++) {
1029 if (ln
== Lanes::EMPTY
)
1032 UINT col
= ( Lanes:: isHead(ln
) ||Lanes:: isTail(ln
) || Lanes::isJoin(ln
)
1033 || ln
==Lanes:: CROSS_EMPTY
) ? activeLane
: i
;
1035 if (ln
== Lanes::CROSS
)
1037 paintGraphLane(hdc
, rect
.Height(),Lanes::NOT_ACTIVE
, x1
, x2
, m_LineColors
[col
% Lanes::COLORS_NUM
],rect
.top
);
1038 paintGraphLane(hdc
, rect
.Height(),Lanes::CROSS
, x1
, x2
, m_LineColors
[activeLane
% Lanes::COLORS_NUM
],rect
.top
);
1041 paintGraphLane(hdc
, rect
.Height(),ln
, x1
, x2
, m_LineColors
[col
% Lanes::COLORS_NUM
],rect
.top
);
1047 void CGitLogListBase::OnNMCustomdrawLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
)
1050 NMLVCUSTOMDRAW
* pLVCD
= reinterpret_cast<NMLVCUSTOMDRAW
*>( pNMHDR
);
1051 // Take the default processing unless we set this to something else below.
1052 *pResult
= CDRF_DODEFAULT
;
1054 if (m_bNoDispUpdates
)
1057 switch (pLVCD
->nmcd
.dwDrawStage
)
1061 *pResult
= CDRF_NOTIFYITEMDRAW
;
1065 case CDDS_ITEMPREPAINT
:
1067 // This is the prepaint stage for an item. Here's where we set the
1068 // item's text color.
1070 // Tell Windows to send draw notifications for each subitem.
1071 *pResult
= CDRF_NOTIFYSUBITEMDRAW
;
1073 COLORREF crText
= GetSysColor(COLOR_WINDOWTEXT
);
1075 if (m_arShownList
.GetCount() > (INT_PTR
)pLVCD
->nmcd
.dwItemSpec
)
1077 GitRev
* data
= (GitRev
*)m_arShownList
.SafeGetAt(pLVCD
->nmcd
.dwItemSpec
);
1080 if (data
->GetAction(this)& (CTGitPath::LOGACTIONS_REBASE_DONE
| CTGitPath::LOGACTIONS_REBASE_SKIP
) )
1081 crText
= RGB(128,128,128);
1083 if(data
->GetAction(this)&CTGitPath::LOGACTIONS_REBASE_SQUASH
)
1084 pLVCD
->clrTextBk
= RGB(156,156,156);
1085 else if(data
->GetAction(this)&CTGitPath::LOGACTIONS_REBASE_EDIT
)
1086 pLVCD
->clrTextBk
= RGB(200,200,128);
1088 pLVCD
->clrTextBk
= ::GetSysColor(COLOR_WINDOW
);
1090 if(data
->GetAction(this)&CTGitPath::LOGACTIONS_REBASE_CURRENT
)
1092 SelectObject(pLVCD
->nmcd
.hdc
, m_boldFont
);
1093 *pResult
= CDRF_NOTIFYSUBITEMDRAW
| CDRF_NEWFONT
;
1096 if (data
->m_CommitHash
== m_HeadHash
&& m_bNoHightlightHead
== FALSE
)
1098 SelectObject(pLVCD
->nmcd
.hdc
, m_boldFont
);
1099 *pResult
= CDRF_NOTIFYSUBITEMDRAW
| CDRF_NEWFONT
;
1102 // if ((data->childStackDepth)||(m_mergedRevs.find(data->Rev) != m_mergedRevs.end()))
1103 // crText = GetSysColor(COLOR_GRAYTEXT);
1105 if (data
->m_CommitHash
.IsEmpty())
1107 //crText = GetSysColor(RGB(200,200,0));
1108 //SelectObject(pLVCD->nmcd.hdc, m_boldFont);
1109 // We changed the font, so we're returning CDRF_NEWFONT. This
1110 // tells the control to recalculate the extent of the text.
1111 *pResult
= CDRF_NOTIFYSUBITEMDRAW
| CDRF_NEWFONT
;
1115 if (m_arShownList
.GetCount() == (INT_PTR
)pLVCD
->nmcd
.dwItemSpec
)
1117 if (m_bStrictStopped
)
1118 crText
= GetSysColor(COLOR_GRAYTEXT
);
1120 // Store the color back in the NMLVCUSTOMDRAW struct.
1121 pLVCD
->clrText
= crText
;
1125 case CDDS_ITEMPREPAINT
|CDDS_ITEM
|CDDS_SUBITEM
:
1127 if ((m_bStrictStopped
)&&(m_arShownList
.GetCount() == (INT_PTR
)pLVCD
->nmcd
.dwItemSpec
))
1129 pLVCD
->nmcd
.uItemState
&= ~(CDIS_SELECTED
|CDIS_FOCUS
);
1132 if (pLVCD
->iSubItem
== LOGLIST_GRAPH
&& m_sFilterText
.IsEmpty())
1134 if (m_arShownList
.GetCount() > (INT_PTR
)pLVCD
->nmcd
.dwItemSpec
&& (!this->m_IsRebaseReplaceGraph
) )
1137 GetSubItemRect((int)pLVCD
->nmcd
.dwItemSpec
, pLVCD
->iSubItem
, LVIR_LABEL
, rect
);
1139 //TRACE(_T("A Graphic left %d right %d\r\n"),rect.left,rect.right);
1140 FillBackGround(pLVCD
->nmcd
.hdc
, pLVCD
->nmcd
.dwItemSpec
,rect
);
1142 GitRev
* data
= (GitRev
*)m_arShownList
.SafeGetAt(pLVCD
->nmcd
.dwItemSpec
);
1143 if( !data
->m_CommitHash
.IsEmpty())
1144 DrawGraph(pLVCD
->nmcd
.hdc
,rect
,pLVCD
->nmcd
.dwItemSpec
);
1146 *pResult
= CDRF_SKIPDEFAULT
;
1151 if (pLVCD
->iSubItem
== LOGLIST_MESSAGE
)
1153 if (m_arShownList
.GetCount() > (INT_PTR
)pLVCD
->nmcd
.dwItemSpec
)
1155 GitRev
* data
= (GitRev
*)m_arShownList
.SafeGetAt(pLVCD
->nmcd
.dwItemSpec
);
1156 //if(!data->m_IsFull)
1158 //if(data->SafeFetchFullInfo(&g_Git))
1159 // this->Invalidate();
1160 //TRACE(_T("Update ... %d\r\n"),pLVCD->nmcd.dwItemSpec);
1163 if (!m_HashMap
[data
->m_CommitHash
].empty())
1167 GetSubItemRect((int)pLVCD
->nmcd
.dwItemSpec
, pLVCD
->iSubItem
, LVIR_BOUNDS
, rect
);
1169 FillBackGround(pLVCD
->nmcd
.hdc
, pLVCD
->nmcd
.dwItemSpec
,rect
);
1170 DrawTagBranch(pLVCD
->nmcd
.hdc
,rect
,pLVCD
->nmcd
.dwItemSpec
);
1172 *pResult
= CDRF_SKIPDEFAULT
;
1180 if (pLVCD
->iSubItem
== LOGLIST_ACTION
)
1182 if(this->m_IsIDReplaceAction
)
1184 *pResult
= CDRF_DODEFAULT
;
1187 *pResult
= CDRF_DODEFAULT
;
1189 if (m_arShownList
.GetCount() <= (INT_PTR
)pLVCD
->nmcd
.dwItemSpec
)
1193 int iconwidth
= ::GetSystemMetrics(SM_CXSMICON
);
1194 int iconheight
= ::GetSystemMetrics(SM_CYSMICON
);
1196 GitRev
* pLogEntry
= reinterpret_cast<GitRev
*>(m_arShownList
.SafeGetAt(pLVCD
->nmcd
.dwItemSpec
));
1198 GetSubItemRect((int)pLVCD
->nmcd
.dwItemSpec
, pLVCD
->iSubItem
, LVIR_BOUNDS
, rect
);
1199 //TRACE(_T("Action left %d right %d\r\n"),rect.left,rect.right);
1200 // Get the selected state of the
1201 // item being drawn.
1203 // Fill the background if necessary
1204 FillBackGround(pLVCD
->nmcd
.hdc
, pLVCD
->nmcd
.dwItemSpec
, rect
);
1206 // Draw the icon(s) into the compatible DC
1207 pLogEntry
->GetAction(this);
1209 if (!pLogEntry
->m_IsDiffFiles
)
1210 ::DrawIconEx(pLVCD
->nmcd
.hdc
, rect
.left
+ ICONITEMBORDER
, rect
.top
, m_hFetchIcon
, iconwidth
, iconheight
, 0, NULL
, DI_NORMAL
);
1212 if (pLogEntry
->GetAction(this) & CTGitPath::LOGACTIONS_MODIFIED
)
1213 ::DrawIconEx(pLVCD
->nmcd
.hdc
, rect
.left
+ ICONITEMBORDER
, rect
.top
, m_hModifiedIcon
, iconwidth
, iconheight
, 0, NULL
, DI_NORMAL
);
1216 if (pLogEntry
->GetAction(this) & (CTGitPath::LOGACTIONS_ADDED
|CTGitPath::LOGACTIONS_COPY
) )
1217 ::DrawIconEx(pLVCD
->nmcd
.hdc
, rect
.left
+nIcons
*iconwidth
+ ICONITEMBORDER
, rect
.top
, m_hAddedIcon
, iconwidth
, iconheight
, 0, NULL
, DI_NORMAL
);
1220 if (pLogEntry
->GetAction(this) & CTGitPath::LOGACTIONS_DELETED
)
1221 ::DrawIconEx(pLVCD
->nmcd
.hdc
, rect
.left
+nIcons
*iconwidth
+ ICONITEMBORDER
, rect
.top
, m_hDeletedIcon
, iconwidth
, iconheight
, 0, NULL
, DI_NORMAL
);
1224 if (pLogEntry
->GetAction(this) & CTGitPath::LOGACTIONS_REPLACED
)
1225 ::DrawIconEx(pLVCD
->nmcd
.hdc
, rect
.left
+nIcons
*iconwidth
+ ICONITEMBORDER
, rect
.top
, m_hReplacedIcon
, iconwidth
, iconheight
, 0, NULL
, DI_NORMAL
);
1227 *pResult
= CDRF_SKIPDEFAULT
;
1233 *pResult
= CDRF_DODEFAULT
;
1236 // CGitLogListBase message handlers
1238 void CGitLogListBase::OnLvnGetdispinfoLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
)
1240 NMLVDISPINFO
*pDispInfo
= reinterpret_cast<NMLVDISPINFO
*>(pNMHDR
);
1242 // Create a pointer to the item
1243 LV_ITEM
* pItem
= &(pDispInfo
)->item
;
1245 // Do the list need text information?
1246 if (!(pItem
->mask
& LVIF_TEXT
))
1249 // By default, clear text buffer.
1250 lstrcpyn(pItem
->pszText
, _T(""), pItem
->cchTextMax
);
1252 bool bOutOfRange
= pItem
->iItem
>= ShownCountWithStopped();
1255 if (m_bNoDispUpdates
|| bOutOfRange
)
1258 // Which item number?
1259 int itemid
= pItem
->iItem
;
1260 GitRev
* pLogEntry
= NULL
;
1261 if (itemid
< m_arShownList
.GetCount())
1262 pLogEntry
= reinterpret_cast<GitRev
*>(m_arShownList
.SafeGetAt(pItem
->iItem
));
1267 temp
.Format(_T("%d"),pItem
->iItem
+1);
1272 temp
.Format(_T("%d"),m_arShownList
.GetCount()-pItem
->iItem
);
1276 switch (pItem
->iSubItem
)
1278 case this->LOGLIST_GRAPH
: //Graphic
1280 case this->LOGLIST_REBASE
:
1282 if(this->m_IsRebaseReplaceGraph
)
1285 path
.m_Action
=pLogEntry
->GetAction(this)&CTGitPath::LOGACTIONS_REBASE_MODE_MASK
;
1286 lstrcpyn(pItem
->pszText
,path
.GetActionName(), pItem
->cchTextMax
);
1290 case this->LOGLIST_ACTION
: //action -- no text in the column
1292 case this->LOGLIST_HASH
:
1294 lstrcpyn(pItem
->pszText
, pLogEntry
->m_CommitHash
.ToString(), pItem
->cchTextMax
);
1296 case this->LOGLIST_ID
:
1297 if(this->m_IsIDReplaceAction
)
1298 lstrcpyn(pItem
->pszText
, temp
, pItem
->cchTextMax
);
1300 case this->LOGLIST_MESSAGE
: //Message
1302 lstrcpyn(pItem
->pszText
, (LPCTSTR
)pLogEntry
->GetSubject(), pItem
->cchTextMax
);
1304 case this->LOGLIST_AUTHOR
: //Author
1306 lstrcpyn(pItem
->pszText
, (LPCTSTR
)pLogEntry
->GetAuthorName(), pItem
->cchTextMax
);
1308 case this->LOGLIST_DATE
: //Date
1309 if ( pLogEntry
&& (!pLogEntry
->m_CommitHash
.IsEmpty()) )
1310 lstrcpyn(pItem
->pszText
,
1311 CLoglistUtils::FormatDateAndTime(pLogEntry
->GetAuthorDate(), m_DateFormat
, true, m_bRelativeTimes
),
1315 case this->LOGLIST_EMAIL
:
1317 lstrcpyn(pItem
->pszText
, (LPCTSTR
)pLogEntry
->GetAuthorEmail(), pItem
->cchTextMax
);
1320 case this->LOGLIST_COMMIT_NAME
: //Commit
1322 lstrcpyn(pItem
->pszText
, (LPCTSTR
)pLogEntry
->GetCommitterName(), pItem
->cchTextMax
);
1325 case this->LOGLIST_COMMIT_EMAIL
: //Commit Email
1327 lstrcpyn(pItem
->pszText
, (LPCTSTR
)pLogEntry
->GetCommitterEmail(), pItem
->cchTextMax
);
1330 case this->LOGLIST_COMMIT_DATE
: //Commit Date
1331 if (pLogEntry
&& (!pLogEntry
->m_CommitHash
.IsEmpty()))
1332 lstrcpyn(pItem
->pszText
,
1333 CLoglistUtils::FormatDateAndTime(pLogEntry
->GetCommitterDate(), m_DateFormat
, true, m_bRelativeTimes
),
1336 case this->LOGLIST_BUG
: //Bug ID
1338 lstrcpyn(pItem
->pszText
, (LPCTSTR
)this->m_ProjectProperties
.FindBugID(pLogEntry
->GetSubject() + _T("\r\n\r\n") + pLogEntry
->GetBody()), pItem
->cchTextMax
);
1346 void CGitLogListBase::OnContextMenu(CWnd
* pWnd
, CPoint point
)
1349 if (pWnd
== GetHeaderCtrl())
1351 return m_ColumnManager
.OnContextMenuHeader(pWnd
,point
,!!IsGroupViewEnabled());
1354 int selIndex
= GetSelectionMark();
1356 return; // nothing selected, nothing to do with a context menu
1358 // if the user selected the info text telling about not all revisions shown due to
1359 // the "stop on copy/rename" option, we also don't show the context menu
1360 if ((m_bStrictStopped
)&&(selIndex
== m_arShownList
.GetCount()))
1363 // if the context menu is invoked through the keyboard, we have to use
1364 // a calculated position on where to anchor the menu on
1365 if ((point
.x
== -1) && (point
.y
== -1))
1368 GetItemRect(selIndex
, &rect
, LVIR_LABEL
);
1369 ClientToScreen(&rect
);
1370 point
= rect
.CenterPoint();
1372 m_nSearchIndex
= selIndex
;
1373 m_bCancelled
= FALSE
;
1375 // calculate some information the context menu commands can use
1376 // CString pathURL = GetURLFromPath(m_path);
1378 POSITION pos
= GetFirstSelectedItemPosition();
1379 int indexNext
= GetNextSelectedItem(pos
);
1383 GitRev
* pSelLogEntry
= reinterpret_cast<GitRev
*>(m_arShownList
.SafeGetAt(indexNext
));
1385 GitRev revSelected
= pSelLogEntry
->Rev
;
1386 GitRev revPrevious
= git_revnum_t(revSelected
)-1;
1387 if ((pSelLogEntry
->pArChangedPaths
)&&(pSelLogEntry
->pArChangedPaths
->GetCount() <= 2))
1389 for (int i
=0; i
<pSelLogEntry
->pArChangedPaths
->GetCount(); ++i
)
1391 LogChangedPath
* changedpath
= (LogChangedPath
*)pSelLogEntry
->pArChangedPaths
->SafeGetAt(i
);
1392 if (changedpath
->lCopyFromRev
)
1393 revPrevious
= changedpath
->lCopyFromRev
;
1396 GitRev revSelected2
;
1399 PLOGENTRYDATA pLogEntry
= reinterpret_cast<PLOGENTRYDATA
>(m_arShownList
.SafeGetAt(GetNextSelectedItem(pos
)));
1400 revSelected2
= pLogEntry
->Rev
;
1402 bool bAllFromTheSameAuthor
= true;
1403 CString firstAuthor
;
1404 CLogDataVector selEntries
;
1405 GitRev revLowest
, revHighest
;
1406 GitRevRangeArray revisionRanges
;
1408 POSITION pos
= GetFirstSelectedItemPosition();
1409 PLOGENTRYDATA pLogEntry
= reinterpret_cast<PLOGENTRYDATA
>(m_arShownList
.SafeGetAt(GetNextSelectedItem(pos
)));
1410 revisionRanges
.AddRevision(pLogEntry
->Rev
);
1411 selEntries
.push_back(pLogEntry
);
1412 firstAuthor
= pLogEntry
->sAuthor
;
1413 revLowest
= pLogEntry
->Rev
;
1414 revHighest
= pLogEntry
->Rev
;
1417 pLogEntry
= reinterpret_cast<PLOGENTRYDATA
>(m_arShownList
.SafeGetAt(GetNextSelectedItem(pos
)));
1418 revisionRanges
.AddRevision(pLogEntry
->Rev
);
1419 selEntries
.push_back(pLogEntry
);
1420 if (firstAuthor
.Compare(pLogEntry
->sAuthor
))
1421 bAllFromTheSameAuthor
= false;
1422 revLowest
= (git_revnum_t(pLogEntry
->Rev
) > git_revnum_t(revLowest
) ? revLowest
: pLogEntry
->Rev
);
1423 revHighest
= (git_revnum_t(pLogEntry
->Rev
) < git_revnum_t(revHighest
) ? revHighest
: pLogEntry
->Rev
);
1429 int FirstSelect
=-1, LastSelect
=-1;
1430 pos
= GetFirstSelectedItemPosition();
1431 FirstSelect
= GetNextSelectedItem(pos
);
1434 LastSelect
= GetNextSelectedItem(pos
);
1436 //entry is selected, now show the popup menu
1438 CIconMenu subbranchmenu
, submenu
, gnudiffmenu
, diffmenu
, revertmenu
;
1440 if (popup
.CreatePopupMenu())
1442 bool isHeadCommit
= (pSelLogEntry
->m_CommitHash
== m_HeadHash
);
1443 CString currentBranch
= _T("refs/heads/") + g_Git
.GetCurrentBranch();
1445 if(m_ContextMenuMask
&GetContextMenuBit(ID_REBASE_PICK
))
1446 popup
.AppendMenuIcon(ID_REBASE_PICK
, IDS_REBASE_PICK
, IDI_PICK
);
1448 if(m_ContextMenuMask
&GetContextMenuBit(ID_REBASE_SQUASH
))
1449 popup
.AppendMenuIcon(ID_REBASE_SQUASH
, IDS_REBASE_SQUASH
, IDI_SQUASH
);
1451 if(m_ContextMenuMask
&GetContextMenuBit(ID_REBASE_EDIT
))
1452 popup
.AppendMenuIcon(ID_REBASE_EDIT
, IDS_REBASE_EDIT
, IDI_EDIT
);
1454 if(m_ContextMenuMask
&GetContextMenuBit(ID_REBASE_SKIP
))
1455 popup
.AppendMenuIcon(ID_REBASE_SKIP
, IDS_REBASE_SKIP
, IDI_SKIP
);
1457 if(m_ContextMenuMask
&(GetContextMenuBit(ID_REBASE_SKIP
)|GetContextMenuBit(ID_REBASE_EDIT
)|
1458 GetContextMenuBit(ID_REBASE_SQUASH
)|GetContextMenuBit(ID_REBASE_PICK
)))
1459 popup
.AppendMenu(MF_SEPARATOR
, NULL
);
1461 if (GetSelectedCount() == 1)
1465 if( !pSelLogEntry
->m_CommitHash
.IsEmpty())
1467 if(m_ContextMenuMask
&GetContextMenuBit(ID_COMPARE
) && m_hasWC
) // compare revision with WC
1468 popup
.AppendMenuIcon(ID_COMPARE
, IDS_LOG_POPUP_COMPARE
, IDI_DIFF
);
1472 if(m_ContextMenuMask
&GetContextMenuBit(ID_COMMIT
))
1473 popup
.AppendMenuIcon(ID_COMMIT
, IDS_LOG_POPUP_COMMIT
, IDI_COMMIT
);
1475 if(m_ContextMenuMask
&GetContextMenuBit(ID_GNUDIFF1
) && m_hasWC
) // compare with WC, unified
1477 GitRev
*pRev
=pSelLogEntry
;
1478 if (pSelLogEntry
->m_ParentHash
.empty())
1480 pRev
->GetParentFromHash(pRev
->m_CommitHash
);
1482 if(pRev
->m_ParentHash
.size()<=1)
1484 popup
.AppendMenuIcon(ID_GNUDIFF1
, IDS_LOG_POPUP_GNUDIFF_CH
, IDI_DIFF
);
1489 gnudiffmenu
.CreatePopupMenu();
1490 popup
.AppendMenuIcon(ID_GNUDIFF1
,IDS_LOG_POPUP_GNUDIFF_PARENT
, IDI_DIFF
, gnudiffmenu
.m_hMenu
);
1492 gnudiffmenu
.AppendMenuIcon((UINT_PTR
)(ID_GNUDIFF1
+ (0xFFFF << 16)), CString(MAKEINTRESOURCE(IDS_ALLPARENTS
)));
1493 gnudiffmenu
.AppendMenuIcon((UINT_PTR
)(ID_GNUDIFF1
+ (0xFFFE << 16)), CString(MAKEINTRESOURCE(IDS_ONLYMERGEDFILES
)));
1495 for(int i
=0;i
<pRev
->m_ParentHash
.size();i
++)
1498 str
.Format(IDS_PARENT
, i
+ 1);
1499 gnudiffmenu
.AppendMenuIcon(ID_GNUDIFF1
+((i
+1)<<16),str
);
1504 if(m_ContextMenuMask
&GetContextMenuBit(ID_COMPAREWITHPREVIOUS
))
1507 GitRev
*pRev
=pSelLogEntry
;
1508 if (pSelLogEntry
->m_ParentHash
.empty())
1510 pRev
->GetParentFromHash(pRev
->m_CommitHash
);
1512 if(pRev
->m_ParentHash
.size()<=1)
1514 popup
.AppendMenuIcon(ID_COMPAREWITHPREVIOUS
, IDS_LOG_POPUP_COMPAREWITHPREVIOUS
, IDI_DIFF
);
1515 if (CRegDWORD(_T("Software\\TortoiseGit\\DiffByDoubleClickInLog"), FALSE
))
1516 popup
.SetDefaultItem(ID_COMPAREWITHPREVIOUS
, FALSE
);
1520 diffmenu
.CreatePopupMenu();
1521 popup
.AppendMenuIcon(ID_COMPAREWITHPREVIOUS
, IDS_LOG_POPUP_COMPAREWITHPREVIOUS
, IDI_DIFF
, diffmenu
.m_hMenu
);
1522 for(int i
=0;i
<pRev
->m_ParentHash
.size();i
++)
1525 str
.Format(IDS_PARENT
, i
+ 1);
1526 diffmenu
.AppendMenuIcon(ID_COMPAREWITHPREVIOUS
+((i
+1)<<16),str
);
1527 if (i
== 0 && CRegDWORD(_T("Software\\TortoiseGit\\DiffByDoubleClickInLog"), FALSE
))
1529 popup
.SetDefaultItem(ID_COMPAREWITHPREVIOUS
, FALSE
);
1530 diffmenu
.SetDefaultItem(ID_COMPAREWITHPREVIOUS
+((i
+1)<<16), FALSE
);
1536 if(m_ContextMenuMask
&GetContextMenuBit(ID_BLAME
))
1537 popup
.AppendMenuIcon(ID_BLAME
, IDS_LOG_POPUP_BLAME
, IDI_BLAME
);
1539 //popup.AppendMenuIcon(ID_BLAMEWITHPREVIOUS, IDS_LOG_POPUP_BLAMEWITHPREVIOUS, IDI_BLAME);
1540 popup
.AppendMenu(MF_SEPARATOR
, NULL
);
1542 if (pSelLogEntry
->m_CommitHash
.IsEmpty())
1544 if(m_ContextMenuMask
&GetContextMenuBit(ID_STASH_SAVE
))
1545 popup
.AppendMenuIcon(ID_STASH_SAVE
, IDS_MENUSTASHSAVE
, IDI_COMMIT
);
1548 bool isStash
= false;
1549 for (int i
= 0; i
< m_HashMap
[pSelLogEntry
->m_CommitHash
].size(); i
++)
1551 if (m_HashMap
[pSelLogEntry
->m_CommitHash
][i
] == _T("refs/stash"))
1558 if (CTGitPath(g_Git
.m_CurrentDir
).HasStashDir() && (pSelLogEntry
->m_CommitHash
.IsEmpty() || isStash
))
1560 if (m_ContextMenuMask
&GetContextMenuBit(ID_STASH_POP
))
1561 popup
.AppendMenuIcon(ID_STASH_POP
, IDS_MENUSTASHPOP
, IDI_RELOCATE
);
1563 if (m_ContextMenuMask
&GetContextMenuBit(ID_STASH_LIST
))
1564 popup
.AppendMenuIcon(ID_STASH_LIST
, IDS_MENUSTASHLIST
, IDI_LOG
);
1566 popup
.AppendMenu(MF_SEPARATOR
, NULL
);
1569 if (pSelLogEntry
->m_CommitHash
.IsEmpty())
1571 if(m_ContextMenuMask
&GetContextMenuBit(ID_FETCH
))
1572 popup
.AppendMenuIcon(ID_FETCH
, IDS_MENUFETCH
, IDI_PULL
);
1574 popup
.AppendMenu(MF_SEPARATOR
, NULL
);
1578 // if (!m_ProjectProperties.sWebViewerRev.IsEmpty())
1580 // popup.AppendMenuIcon(ID_VIEWREV, IDS_LOG_POPUP_VIEWREV);
1582 // if (!m_ProjectProperties.sWebViewerPathRev.IsEmpty())
1584 // popup.AppendMenuIcon(ID_VIEWPATHREV, IDS_LOG_POPUP_VIEWPATHREV);
1586 // if ((!m_ProjectProperties.sWebViewerPathRev.IsEmpty())||
1587 // (!m_ProjectProperties.sWebViewerRev.IsEmpty()))
1589 // popup.AppendMenu(MF_SEPARATOR, NULL);
1594 // popup.AppendMenuIcon(ID_REVERTTOREV, IDS_LOG_POPUP_REVERTTOREV, IDI_REVERT);
1596 if(!pSelLogEntry
->m_CommitHash
.IsEmpty())
1598 if((m_ContextMenuMask
&GetContextMenuBit(ID_LOG
)) &&
1599 GetSelectedCount() == 1)
1600 popup
.AppendMenuIcon(ID_LOG
, IDS_LOG_POPUP_LOG
, IDI_LOG
);
1602 if (m_ContextMenuMask
&GetContextMenuBit(ID_REPOBROWSE
))
1603 popup
.AppendMenuIcon(ID_REPOBROWSE
, IDS_LOG_BROWSEREPO
, IDI_REPOBROWSE
);
1605 format
.LoadString(IDS_LOG_POPUP_MERGEREV
);
1606 str
.Format(format
,g_Git
.GetCurrentBranch());
1608 if (m_ContextMenuMask
&GetContextMenuBit(ID_MERGEREV
) && !isHeadCommit
&& m_hasWC
)
1609 popup
.AppendMenuIcon(ID_MERGEREV
, str
, IDI_MERGE
);
1611 format
.LoadString(IDS_RESET_TO_THIS_FORMAT
);
1612 str
.Format(format
,g_Git
.GetCurrentBranch());
1614 if(m_ContextMenuMask
&GetContextMenuBit(ID_RESET
) && m_hasWC
)
1615 popup
.AppendMenuIcon(ID_RESET
,str
,IDI_REVERT
);
1618 // Add Switch Branch express Menu
1619 if( this->m_HashMap
.find(pSelLogEntry
->m_CommitHash
) != m_HashMap
.end()
1620 && (m_ContextMenuMask
&GetContextMenuBit(ID_SWITCHBRANCH
) && m_hasWC
)
1623 std::vector
<CString
*> branchs
;
1624 for(int i
=0;i
<m_HashMap
[pSelLogEntry
->m_CommitHash
].size();i
++)
1626 CString ref
= m_HashMap
[pSelLogEntry
->m_CommitHash
][i
];
1627 if(ref
.Find(_T("refs/heads/")) == 0 && ref
!= currentBranch
)
1629 branchs
.push_back(&m_HashMap
[pSelLogEntry
->m_CommitHash
][i
]);
1634 str
.LoadString(IDS_SWITCH_BRANCH
);
1636 if(branchs
.size() == 1)
1639 str
+= _T('"') + branchs
[0]->Mid(11) + _T('"');
1640 popup
.AppendMenuIcon(ID_SWITCHBRANCH
,str
,IDI_SWITCH
);
1642 popup
.SetMenuItemData(ID_SWITCHBRANCH
,(ULONG_PTR
)branchs
[0]);
1645 else if(branchs
.size() > 1)
1647 subbranchmenu
.CreatePopupMenu();
1648 for(int i
=0;i
<branchs
.size();i
++)
1650 if (*branchs
[i
] != currentBranch
)
1652 subbranchmenu
.AppendMenuIcon(ID_SWITCHBRANCH
+(i
<<16), branchs
[i
]->Mid(11));
1653 subbranchmenu
.SetMenuItemData(ID_SWITCHBRANCH
+(i
<<16), (ULONG_PTR
) branchs
[i
]);
1657 popup
.AppendMenuIcon(ID_SWITCHBRANCH
, str
, IDI_SWITCH
, subbranchmenu
.m_hMenu
);
1661 if(m_ContextMenuMask
&GetContextMenuBit(ID_SWITCHTOREV
) && !isHeadCommit
&& m_hasWC
)
1662 popup
.AppendMenuIcon(ID_SWITCHTOREV
, IDS_SWITCH_TO_THIS
, IDI_SWITCH
);
1664 if(m_ContextMenuMask
&GetContextMenuBit(ID_CREATE_BRANCH
))
1665 popup
.AppendMenuIcon(ID_CREATE_BRANCH
, IDS_CREATE_BRANCH_AT_THIS
, IDI_COPY
);
1667 if(m_ContextMenuMask
&GetContextMenuBit(ID_CREATE_TAG
))
1668 popup
.AppendMenuIcon(ID_CREATE_TAG
,IDS_CREATE_TAG_AT_THIS
, IDI_TAG
);
1670 format
.LoadString(IDS_REBASE_THIS_FORMAT
);
1671 str
.Format(format
,g_Git
.GetCurrentBranch());
1673 if(pSelLogEntry
->m_CommitHash
!= m_HeadHash
&& m_hasWC
)
1674 if(m_ContextMenuMask
&GetContextMenuBit(ID_REBASE_TO_VERSION
))
1675 popup
.AppendMenuIcon(ID_REBASE_TO_VERSION
, str
, IDI_REBASE
);
1677 if(m_ContextMenuMask
&GetContextMenuBit(ID_EXPORT
))
1678 popup
.AppendMenuIcon(ID_EXPORT
,IDS_EXPORT_TO_THIS
, IDI_EXPORT
);
1680 if (m_ContextMenuMask
&GetContextMenuBit(ID_REVERTREV
) && m_hasWC
)
1682 GitRev
*pRev
= pSelLogEntry
;
1683 if (pSelLogEntry
->m_ParentHash
.empty())
1685 pRev
->GetParentFromHash(pRev
->m_CommitHash
);
1687 if (pRev
->m_ParentHash
.size() == 1)
1689 popup
.AppendMenuIcon(ID_REVERTREV
, IDS_LOG_POPUP_REVERTREV
, IDI_REVERT
);
1693 revertmenu
.CreatePopupMenu();
1694 popup
.AppendMenuIcon(ID_REVERTREV
, IDS_LOG_POPUP_REVERTREV
, IDI_REVERT
, revertmenu
.m_hMenu
);
1696 for (int i
= 0; i
< pRev
->m_ParentHash
.size(); i
++)
1699 str
.Format(IDS_PARENT
, i
+ 1);
1700 revertmenu
.AppendMenuIcon(ID_REVERTREV
+ ((i
+ 1) << 16), str
);
1705 if (m_ContextMenuMask
&GetContextMenuBit(ID_EDITNOTE
))
1706 popup
.AppendMenuIcon(ID_EDITNOTE
, IDS_EDIT_NOTES
, IDI_EDIT
);
1708 popup
.AppendMenu(MF_SEPARATOR
, NULL
);
1713 if(!pSelLogEntry
->m_Ref
.IsEmpty())
1715 popup
.AppendMenuIcon(ID_REFLOG_DEL
, IDS_REFLOG_DEL
, IDI_DELETE
);
1716 if (GetSelectedCount() == 1 && pSelLogEntry
->m_Ref
.Find(_T("refs/stash")) == 0)
1717 popup
.AppendMenuIcon(ID_REFLOG_STASH_APPLY
, IDS_MENUSTASHAPPLY
, IDI_RELOCATE
);
1718 popup
.AppendMenu(MF_SEPARATOR
, NULL
);
1721 if (GetSelectedCount() >= 2)
1723 bool bAddSeparator
= false;
1724 if (IsSelectionContinuous() || (GetSelectedCount() == 2))
1726 if(m_ContextMenuMask
&GetContextMenuBit(ID_COMPARETWO
)) // compare two revisions
1727 popup
.AppendMenuIcon(ID_COMPARETWO
, IDS_LOG_POPUP_COMPARETWO
, IDI_DIFF
);
1730 if (GetSelectedCount() == 2)
1732 if(m_ContextMenuMask
&GetContextMenuBit(ID_GNUDIFF2
) && m_hasWC
) // compare two revisions, unified
1733 popup
.AppendMenuIcon(ID_GNUDIFF2
, IDS_LOG_POPUP_GNUDIFF
, IDI_DIFF
);
1734 bAddSeparator
= true;
1739 bAddSeparator
= true;
1742 if (m_ContextMenuMask
&GetContextMenuBit(ID_REVERTREV
) && m_hasWC
)
1743 popup
.AppendMenuIcon(ID_REVERTREV
, IDS_LOG_POPUP_REVERTREVS
, IDI_REVERT
);
1746 popup
.AppendMenu(MF_SEPARATOR
, NULL
);
1749 if ( GetSelectedCount() >0 && (!pSelLogEntry
->m_CommitHash
.IsEmpty()))
1751 bool bAddSeparator
= false;
1752 if ( IsSelectionContinuous() && GetSelectedCount() >= 2 )
1754 if(m_ContextMenuMask
&GetContextMenuBit(ID_COMBINE_COMMIT
) && m_hasWC
)
1758 headindex
= this->GetHeadIndex();
1761 head
.Format(_T("HEAD~%d"),LastSelect
-headindex
);
1762 CGitHash hash
=g_Git
.GetHash(head
);
1763 GitRev
* pLastEntry
= reinterpret_cast<GitRev
*>(m_arShownList
.SafeGetAt(LastSelect
));
1764 if(pLastEntry
->m_CommitHash
== hash
) {
1765 popup
.AppendMenuIcon(ID_COMBINE_COMMIT
,IDS_COMBINE_TO_ONE
,IDI_COMBINE
);
1766 bAddSeparator
= true;
1771 if(m_ContextMenuMask
&GetContextMenuBit(ID_CHERRY_PICK
) && !isHeadCommit
&& m_hasWC
) {
1772 if (GetSelectedCount() >= 2)
1773 popup
.AppendMenuIcon(ID_CHERRY_PICK
, IDS_CHERRY_PICK_VERSIONS
, IDI_EXPORT
);
1775 popup
.AppendMenuIcon(ID_CHERRY_PICK
, IDS_CHERRY_PICK_VERSION
, IDI_EXPORT
);
1776 bAddSeparator
= true;
1779 if(GetSelectedCount()<=2 || (IsSelectionContinuous() && GetSelectedCount() > 0))
1780 if(m_ContextMenuMask
&GetContextMenuBit(ID_CREATE_PATCH
)) {
1781 popup
.AppendMenuIcon(ID_CREATE_PATCH
, IDS_CREATE_PATCH
, IDI_PATCH
);
1782 bAddSeparator
= true;
1786 popup
.AppendMenu(MF_SEPARATOR
, NULL
);
1789 if (m_hasWC
&& (m_ContextMenuMask
& GetContextMenuBit(ID_BISECTSTART
)) && GetSelectedCount() == 2 && !reinterpret_cast<GitRev
*>(m_arShownList
.SafeGetAt(FirstSelect
))->m_CommitHash
.IsEmpty() && !CTGitPath(g_Git
.m_CurrentDir
).IsBisectActive())
1791 popup
.AppendMenuIcon(ID_BISECTSTART
, IDS_MENUBISECTSTART
);
1792 popup
.AppendMenu(MF_SEPARATOR
, NULL
);
1795 if (GetSelectedCount() == 1)
1797 bool bAddSeparator
= false;
1798 if(m_ContextMenuMask
&GetContextMenuBit(ID_PUSH
) && !m_HashMap
[pSelLogEntry
->m_CommitHash
].empty())
1800 // show the push-option only if the log entry has an associated local branch
1801 bool isLocal
= false;
1802 for(int i
=0; isLocal
== false && i
< m_HashMap
[pSelLogEntry
->m_CommitHash
].size(); i
++)
1804 if (m_HashMap
[pSelLogEntry
->m_CommitHash
][i
].Find(_T("refs/heads/")) == 0)
1809 popup
.AppendMenuIcon(ID_PUSH
, IDS_LOG_PUSH
, IDI_PUSH
);
1810 bAddSeparator
= true;
1814 if(m_ContextMenuMask
&GetContextMenuBit(ID_DELETE
))
1816 if( this->m_HashMap
.find(pSelLogEntry
->m_CommitHash
) != m_HashMap
.end() )
1818 std::vector
<CString
*> branchs
;
1819 for (int i
= 0; i
< m_HashMap
[pSelLogEntry
->m_CommitHash
].size(); i
++)
1821 if(m_HashMap
[pSelLogEntry
->m_CommitHash
][i
] != currentBranch
)
1822 branchs
.push_back(&m_HashMap
[pSelLogEntry
->m_CommitHash
][i
]);
1825 if (branchs
.size() == 1)
1827 str
.LoadString(IDS_DELETE_BRANCHTAG_SHORT
);
1830 popup
.AppendMenuIcon(ID_DELETE
, str
, IDI_DELETE
);
1831 popup
.SetMenuItemData(ID_DELETE
, (ULONG_PTR
)branchs
[0]);
1832 bAddSeparator
= true;
1834 else if (branchs
.size() > 1)
1836 str
.LoadString(IDS_DELETE_BRANCHTAG
);
1837 submenu
.CreatePopupMenu();
1838 for (int i
= 0; i
< branchs
.size(); i
++)
1840 submenu
.AppendMenuIcon(ID_DELETE
+ (i
<< 16), *branchs
[i
]);
1841 submenu
.SetMenuItemData(ID_DELETE
+ (i
<< 16), (ULONG_PTR
)branchs
[i
]);
1844 popup
.AppendMenuIcon(ID_DELETE
,str
, IDI_DELETE
, submenu
.m_hMenu
);
1845 bAddSeparator
= true;
1848 } // m_ContextMenuMask &GetContextMenuBit(ID_DELETE)
1850 popup
.AppendMenu(MF_SEPARATOR
, NULL
);
1851 } // GetSelectedCount() == 1
1853 if (GetSelectedCount() != 0)
1855 if(m_ContextMenuMask
&GetContextMenuBit(ID_COPYHASH
))
1856 popup
.AppendMenuIcon(ID_COPYHASH
, IDS_COPY_COMMIT_HASH
, IDI_COPYCLIP
);
1857 if(m_ContextMenuMask
&GetContextMenuBit(ID_COPYCLIPBOARD
))
1858 popup
.AppendMenuIcon(ID_COPYCLIPBOARD
, IDS_LOG_POPUP_COPYTOCLIPBOARD
, IDI_COPYCLIP
);
1859 if(m_ContextMenuMask
&GetContextMenuBit(ID_COPYCLIPBOARDMESSAGES
))
1860 popup
.AppendMenuIcon(ID_COPYCLIPBOARDMESSAGES
, IDS_LOG_POPUP_COPYTOCLIPBOARDMESSAGES
, IDI_COPYCLIP
);
1863 if(m_ContextMenuMask
&GetContextMenuBit(ID_FINDENTRY
))
1864 popup
.AppendMenuIcon(ID_FINDENTRY
, IDS_LOG_POPUP_FIND
, IDI_FILTEREDIT
);
1866 if (GetSelectedCount() == 1 && m_ContextMenuMask
& GetContextMenuBit(ID_SHOWBRANCHES
) && !pSelLogEntry
->m_CommitHash
.IsEmpty())
1867 popup
.AppendMenuIcon(ID_SHOWBRANCHES
, IDS_LOG_POPUP_SHOWBRANCHES
, IDI_SHOWBRANCHES
);
1869 int cmd
= popup
.TrackPopupMenu(TPM_RETURNCMD
| TPM_LEFTALIGN
| TPM_NONOTIFY
, point
.x
, point
.y
, this, 0);
1870 // DialogEnableWindow(IDOK, FALSE);
1871 // SetPromptApp(&theApp);
1873 this->ContextMenuAction(cmd
, FirstSelect
, LastSelect
, &popup
);
1875 // EnableOKButton();
1876 } // if (popup.CreatePopupMenu())
1880 bool CGitLogListBase::IsSelectionContinuous()
1882 if ( GetSelectedCount()==1 )
1884 // if only one revision is selected, the selection is of course
1889 POSITION pos
= GetFirstSelectedItemPosition();
1890 bool bContinuous
= (m_arShownList
.GetCount() == (INT_PTR
)m_logEntries
.size());
1893 int itemindex
= GetNextSelectedItem(pos
);
1896 int nextindex
= GetNextSelectedItem(pos
);
1897 if (nextindex
- itemindex
> 1)
1899 bContinuous
= false;
1902 itemindex
= nextindex
;
1908 void CGitLogListBase::CopySelectionToClipBoard(int toCopy
)
1912 POSITION pos
= GetFirstSelectedItemPosition();
1916 sRev
.LoadString(IDS_LOG_REVISION
);
1918 sAuthor
.LoadString(IDS_LOG_AUTHOR
);
1920 sDate
.LoadString(IDS_LOG_DATE
);
1922 sMessage
.LoadString(IDS_LOG_MESSAGE
);
1926 CString sLogCopyText
;
1928 GitRev
* pLogEntry
= reinterpret_cast<GitRev
*>(m_arShownList
.SafeGetAt(GetNextSelectedItem(pos
)));
1930 if (toCopy
== ID_COPY_ALL
)
1932 //pLogEntry->GetFiles(this)
1933 //LogChangedPathArray * cpatharray = pLogEntry->pArChangedPaths;
1935 CString
from(MAKEINTRESOURCE(IDS_STATUSLIST_FROM
));
1936 for (int cpPathIndex
= 0; cpPathIndex
<pLogEntry
->GetFiles(this).GetCount(); ++cpPathIndex
)
1938 sPaths
+= ((CTGitPath
&)pLogEntry
->GetFiles(this)[cpPathIndex
]).GetActionName() + _T(": ") + pLogEntry
->GetFiles(this)[cpPathIndex
].GetGitPathString();
1939 if (((CTGitPath
&)pLogEntry
->GetFiles(this)[cpPathIndex
]).m_Action
& (CTGitPath::LOGACTIONS_REPLACED
|CTGitPath::LOGACTIONS_COPY
) && !((CTGitPath
&)pLogEntry
->GetFiles(this)[cpPathIndex
]).GetGitOldPathString().IsEmpty())
1942 rename
.Format(from
, ((CTGitPath
&)pLogEntry
->GetFiles(this)[cpPathIndex
]).GetGitOldPathString());
1943 sPaths
+= _T(" ") + rename
;
1945 sPaths
+= _T("\r\n");
1948 CString body
= pLogEntry
->GetBody();
1949 body
.Replace(_T("\n"), _T("\r\n"));
1950 sLogCopyText
.Format(_T("%s: %s\r\n%s: %s <%s>\r\n%s: %s\r\n%s:\r\n%s\r\n----\r\n%s\r\n\r\n"),
1951 (LPCTSTR
)sRev
, pLogEntry
->m_CommitHash
.ToString(),
1952 (LPCTSTR
)sAuthor
, (LPCTSTR
)pLogEntry
->GetAuthorName(), (LPCTSTR
)pLogEntry
->GetAuthorEmail(),
1954 (LPCTSTR
)CLoglistUtils::FormatDateAndTime(pLogEntry
->GetAuthorDate(), m_DateFormat
, true, m_bRelativeTimes
),
1955 (LPCTSTR
)sMessage
, (pLogEntry
->GetSubject().Trim() + _T("\r\n\r\n") + body
.Trim()).Trim(),
1957 sClipdata
+= sLogCopyText
;
1959 else if (toCopy
== ID_COPY_MESSAGE
)
1961 CString body
= pLogEntry
->GetBody();
1962 body
.Replace(_T("\n"), _T("\r\n"));
1963 sClipdata
+= _T("* ") + (pLogEntry
->GetSubject().Trim() + _T("\r\n\r\n") + body
.Trim()).Trim() + _T("\r\n\r\n");
1965 else if (toCopy
== ID_COPY_SUBJECT
)
1967 sClipdata
+= _T("* ") + pLogEntry
->GetSubject().Trim() + _T("\r\n\r\n");
1972 sClipdata
+= _T("\r\n");
1973 sClipdata
+= pLogEntry
->m_CommitHash
;
1978 CStringUtils::WriteAsciiStringToClipboard(sClipdata
, GetSafeHwnd());
1983 void CGitLogListBase::DiffSelectedRevWithPrevious()
1985 if (m_bThreadRunning
)
1988 int FirstSelect
=-1, LastSelect
=-1;
1989 POSITION pos
= GetFirstSelectedItemPosition();
1990 FirstSelect
= GetNextSelectedItem(pos
);
1993 LastSelect
= GetNextSelectedItem(pos
);
1996 ContextMenuAction(ID_COMPAREWITHPREVIOUS
,FirstSelect
,LastSelect
, NULL
);
1999 UpdateLogInfoLabel();
2000 int selIndex
= m_LogList
.GetSelectionMark();
2003 int selCount
= m_LogList
.GetSelectedCount();
2007 // Find selected entry in the log list
2008 POSITION pos
= m_LogList
.GetFirstSelectedItemPosition();
2009 PLOGENTRYDATA pLogEntry
= reinterpret_cast<PLOGENTRYDATA
>(m_arShownList
.SafeGetAt(m_LogList
.GetNextSelectedItem(pos
)));
2010 long rev1
= pLogEntry
->Rev
;
2012 CTGitPath path
= m_path
;
2014 // See how many files under the relative root were changed in selected revision
2016 LogChangedPath
* changed
= NULL
;
2017 for (INT_PTR c
= 0; c
< pLogEntry
->pArChangedPaths
->GetCount(); ++c
)
2019 LogChangedPath
* cpath
= pLogEntry
->pArChangedPaths
->SafeGetAt(c
);
2020 if (cpath
&& cpath
-> sPath
.Left(m_sRelativeRoot
.GetLength()).Compare(m_sRelativeRoot
)==0)
2027 if (m_path
.IsDirectory() && nChanged
== 1)
2029 // We're looking at the log for a directory and only one file under dir was changed in the revision
2030 // Do diff on that file instead of whole directory
2031 path
.AppendPathString(changed
->sPath
.Mid(m_sRelativeRoot
.GetLength()));
2034 m_bCancelled
= FALSE
;
2035 DialogEnableWindow(IDOK
, FALSE
);
2036 SetPromptApp(&theApp
);
2037 theApp
.DoWaitCursor(1);
2041 GitDiff
diff(this, m_hWnd
, true);
2042 diff
.SetAlternativeTool(!!(GetAsyncKeyState(VK_SHIFT
) & 0x8000));
2043 diff
.SetHEADPeg(m_LogRevision
);
2044 diff
.ShowCompare(path
, rev2
, path
, rev1
);
2048 CAppUtils::StartShowCompare(m_hWnd
, path
, rev2
, path
, rev1
, GitRev(), m_LogRevision
, !!(GetAsyncKeyState(VK_SHIFT
) & 0x8000));
2051 theApp
.DoWaitCursor(-1);
2056 void CGitLogListBase::OnLvnOdfinditemLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
)
2058 LPNMLVFINDITEM pFindInfo
= reinterpret_cast<LPNMLVFINDITEM
>(pNMHDR
);
2061 if (pFindInfo
->lvfi
.flags
& LVFI_PARAM
)
2063 if ((pFindInfo
->iStart
< 0)||(pFindInfo
->iStart
>= m_arShownList
.GetCount()))
2065 if (pFindInfo
->lvfi
.psz
== 0)
2068 CString sCmp
= pFindInfo
->lvfi
.psz
;
2070 for (int i
=pFindInfo
->iStart
; i
<m_arShownList
.GetCount(); ++i
)
2072 GitRev
* pLogEntry
= reinterpret_cast<GitRev
*>(m_arShownList
.SafeGetAt(i
));
2073 sRev
.Format(_T("%ld"), pLogEntry
->Rev
);
2074 if (pFindInfo
->lvfi
.flags
& LVFI_PARTIAL
)
2076 if (sCmp
.Compare(sRev
.Left(sCmp
.GetLength()))==0)
2084 if (sCmp
.Compare(sRev
)==0)
2091 if (pFindInfo
->lvfi
.flags
& LVFI_WRAP
)
2093 for (int i
=0; i
<pFindInfo
->iStart
; ++i
)
2095 PLOGENTRYDATA pLogEntry
= reinterpret_cast<PLOGENTRYDATA
>(m_arShownList
.SafeGetAt(i
));
2096 sRev
.Format(_T("%ld"), pLogEntry
->Rev
);
2097 if (pFindInfo
->lvfi
.flags
& LVFI_PARTIAL
)
2099 if (sCmp
.Compare(sRev
.Left(sCmp
.GetLength()))==0)
2107 if (sCmp
.Compare(sRev
)==0)
2119 int CGitLogListBase::FillGitLog(CTGitPath
*path
,int info
,CString
*from
,CString
*to
)
2123 this->m_arShownList
.SafeRemoveAll();
2125 this->m_logEntries
.ClearAll();
2126 if (this->m_logEntries
.ParserFromLog(path
,-1,info
,from
,to
))
2129 //this->m_logEntries.ParserFromLog();
2130 SetItemCountEx((int)m_logEntries
.size());
2132 for(unsigned int i
=0;i
<m_logEntries
.size();i
++)
2136 m_logEntries
.GetGitRevAt(m_logEntries
.size()-i
-1).m_IsFull
=TRUE
;
2137 this->m_arShownList
.SafeAdd(&m_logEntries
.GetGitRevAt(m_logEntries
.size()-i
-1));
2142 m_logEntries
.GetGitRevAt(i
).m_IsFull
=TRUE
;
2143 this->m_arShownList
.SafeAdd(&m_logEntries
.GetGitRevAt(i
));
2155 int CGitLogListBase::BeginFetchLog()
2159 this->m_arShownList
.SafeRemoveAll();
2161 this->m_logEntries
.ClearAll();
2163 this->m_LogCache
.ClearAllParent();
2165 m_LogCache
.FetchCacheIndex(g_Git
.m_CurrentDir
);
2168 if(this->m_Path
.IsEmpty())
2175 mask
= CGit::LOG_INFO_ONLY_HASH
| CGit::LOG_INFO_BOUNDARY
;
2176 // if(this->m_bAllBranch)
2177 mask
|= m_ShowMask
;
2181 this->m_logEntries
.insert(m_logEntries
.begin(),this->m_wcRev
.m_CommitHash
);
2183 this->m_LogCache
.m_HashMap
[m_wcRev
.m_CommitHash
]=m_wcRev
;
2186 CString
*pFrom
, *pTo
;
2188 CString
head(_T("HEAD"));
2189 if(!this->m_startrev
.IsEmpty())
2191 pFrom
= &this->m_startrev
;
2192 if(!this->m_endrev
.IsEmpty())
2193 pTo
= &this->m_endrev
;
2199 data
.m_From
= m_From
;
2202 #if 0 /* use tortoiegit filter */
2203 if(this->m_nSelectedFilter
== LOGFILTER_ALL
|| m_nSelectedFilter
== LOGFILTER_AUTHORS
)
2204 data
.m_Author
= this->m_sFilterText
;
2206 if(this->m_nSelectedFilter
== LOGFILTER_ALL
|| m_nSelectedFilter
== LOGFILTER_MESSAGES
)
2207 data
.m_MessageFilter
= this->m_sFilterText
;
2209 data
.m_IsRegex
= m_bFilterWithRegex
;
2212 // follow does not work for directories
2213 if (!path
|| path
->IsDirectory())
2214 mask
&= ~CGit::LOG_INFO_FOLLOW
;
2215 // follow does not work with all branches 8at least in TGit)
2216 if (mask
& CGit::LOG_INFO_FOLLOW
)
2217 mask
&= ~CGit::LOG_INFO_ALL_BRANCH
;
2219 CString cmd
=g_Git
.GetLogCmd(m_StartRef
,path
,-1,mask
,pFrom
,pTo
,true,&data
);
2221 //this->m_logEntries.ParserFromLog();
2222 if(IsInWorkingThread())
2224 PostMessage(LVM_SETITEMCOUNT
, (WPARAM
) this->m_logEntries
.size(),(LPARAM
) LVSICF_NOINVALIDATEALL
);
2228 SetItemCountEx((int)m_logEntries
.size());
2238 MessageBox(_T("Could not initialize libgit.\nlibgit reports:\n") + err
, _T("TortoiseGit"), MB_ICONERROR
);
2242 if (g_Git
.IsOrphanBranch(m_StartRef
))
2244 if (!(mask
& CGit::LOG_INFO_ALL_BRANCH
))
2247 // if show all branches, pick any ref as dummy entry ref
2249 g_Git
.GetRefList(list
);
2250 if (list
.size() == 0)
2253 cmd
= g_Git
.GetLogCmd(list
[0], path
, -1, mask
, pFrom
, pTo
, true, &data
);
2257 if (git_open_log(&m_DllGitLog
, CUnicodeUtils::GetMulti(cmd
, CP_UTF8
).GetBuffer()))
2265 MessageBox(_T("Could not open log.\nlibgit reports:\n") + err
, _T("TortoiseGit"), MB_ICONERROR
);
2272 BOOL
CGitLogListBase::PreTranslateMessage(MSG
* pMsg
)
2274 if (pMsg
->message
== WM_KEYDOWN
&& pMsg
->wParam
=='\r')
2276 //if (GetFocus()==GetDlgItem(IDC_LOGLIST))
2278 if (CRegDWORD(_T("Software\\TortoiseGit\\DiffByDoubleClickInLog"), FALSE
))
2280 DiffSelectedRevWithPrevious();
2285 if (GetFocus()==GetDlgItem(IDC_LOGMSG
))
2292 else if (pMsg
->message
== WM_KEYDOWN
&& pMsg
->wParam
== 'A' && GetAsyncKeyState(VK_CONTROL
)&0x8000)
2294 // select all entries
2295 for (int i
=0; i
<GetItemCount(); ++i
)
2297 SetItemState(i
, LVIS_SELECTED
, LVIS_SELECTED
);
2303 if (m_hAccel
&& !bSkipAccelerator
)
2305 int ret
= TranslateAccelerator(m_hWnd
, m_hAccel
, pMsg
);
2311 //m_tooltips.RelayEvent(pMsg);
2312 return __super::PreTranslateMessage(pMsg
);
2315 void CGitLogListBase::OnNMDblclkLoglist(NMHDR
* /*pNMHDR*/, LRESULT
*pResult
)
2317 // a double click on an entry in the revision list has happened
2320 if (CRegDWORD(_T("Software\\TortoiseGit\\DiffByDoubleClickInLog"), FALSE
))
2321 DiffSelectedRevWithPrevious();
2324 int CGitLogListBase::FetchLogAsync(void * data
)
2327 m_bExitThread
=FALSE
;
2328 InterlockedExchange(&m_bThreadRunning
, TRUE
);
2329 InterlockedExchange(&m_bNoDispUpdates
, TRUE
);
2330 m_LoadingThread
= AfxBeginThread(LogThreadEntry
, this, THREAD_PRIORITY_LOWEST
);
2331 if (m_LoadingThread
==NULL
)
2333 InterlockedExchange(&m_bThreadRunning
, FALSE
);
2334 InterlockedExchange(&m_bNoDispUpdates
, FALSE
);
2335 CMessageBox::Show(NULL
, IDS_ERR_THREADSTARTFAILED
, IDS_APPNAME
, MB_OK
| MB_ICONERROR
);
2341 //this is the thread function which calls the subversion function
2342 UINT
CGitLogListBase::LogThreadEntry(LPVOID pVoid
)
2344 return ((CGitLogListBase
*)pVoid
)->LogThread();
2347 void CGitLogListBase::GetTimeRange(CTime
&oldest
, CTime
&latest
)
2350 oldest
=CTime::GetCurrentTime();
2351 latest
=CTime(1971,1,2,0,0,0);
2352 for(unsigned int i
=0;i
<m_logEntries
.size();i
++)
2354 if(m_logEntries
[i
].IsEmpty())
2357 if(m_logEntries
.GetGitRevAt(i
).GetAuthorDate().GetTime() < oldest
.GetTime())
2358 oldest
= m_logEntries
.GetGitRevAt(i
).GetAuthorDate().GetTime();
2360 if(m_logEntries
.GetGitRevAt(i
).GetAuthorDate().GetTime() > latest
.GetTime())
2361 latest
= m_logEntries
.GetGitRevAt(i
).GetAuthorDate().GetTime();
2369 UINT
CGitLogListBase::LogThread()
2371 ::PostMessage(this->GetParent()->m_hWnd
,MSG_LOAD_PERCENTAGE
,(WPARAM
) GITLOG_START
,0);
2373 InterlockedExchange(&m_bThreadRunning
, TRUE
);
2374 InterlockedExchange(&m_bNoDispUpdates
, TRUE
);
2380 InterlockedExchange(&m_bThreadRunning
, FALSE
);
2381 InterlockedExchange(&m_bNoDispUpdates
, FALSE
);
2386 tr1::wregex pat
;//(_T("Remove"), tr1::regex_constants::icase);
2387 bool bRegex
= false;
2388 if (m_bFilterWithRegex
)
2389 bRegex
= ValidateRegexp(m_sFilterText
, pat
, false);
2391 TRACE(_T("\n===Begin===\n"));
2392 //Update work copy item;
2394 if (!m_logEntries
.empty())
2396 GitRev
*pRev
= &m_logEntries
.GetGitRevAt(0);
2398 m_arShownList
.SafeAdd(pRev
);
2402 InterlockedExchange(&m_bNoDispUpdates
, FALSE
);
2404 // store commit number of the last selected commit/line before the refresh or -1
2405 int lastSelectedHashNItem
= -1;
2408 bool shouldWalk
= true;
2409 if (g_Git
.IsOrphanBranch(m_StartRef
))
2411 // walk revisions if show all branches and there exists any ref
2412 if (!(m_ShowMask
& CGit::LOG_INFO_ALL_BRANCH
))
2417 g_Git
.GetRefList(list
);
2418 if (list
.size() == 0)
2425 g_Git
.m_critGitDllSec
.Lock();
2429 git_get_log_firstcommit(m_DllGitLog
);
2430 total
= git_get_log_estimate_commit_count(m_DllGitLog
);
2435 MessageBox(_T("Could not get first commit.\nlibgit reports:\n") + err
, _T("TortoiseGit"), MB_ICONERROR
);
2438 g_Git
.m_critGitDllSec
.Unlock();
2441 t2
=t1
=GetTickCount();
2442 int oldprecentage
= 0;
2443 size_t oldsize
= m_logEntries
.size();
2444 while (ret
== 0 && !m_bExitThread
)
2446 g_Git
.m_critGitDllSec
.Lock();
2449 ret
= git_get_log_nextcommit(this->m_DllGitLog
, &commit
, m_ShowMask
& CGit::LOG_INFO_FOLLOW
);
2453 g_Git
.m_critGitDllSec
.Unlock();
2455 MessageBox(_T("Could not get next commit.\nlibgit reports:\n") + err
, _T("TortoiseGit"), MB_ICONERROR
);
2458 g_Git
.m_critGitDllSec
.Unlock();
2463 if (commit
.m_ignore
== 1)
2465 git_free_commit(&commit
);
2469 //printf("%s\r\n",commit.GetSubject());
2473 CGitHash hash
= (char*)commit
.m_hash
;
2475 GitRev
*pRev
= m_LogCache
.GetCacheData(hash
);
2476 pRev
->m_GitCommit
= commit
;
2477 InterlockedExchange(&pRev
->m_IsCommitParsed
, FALSE
);
2480 g_Git
.m_critGitDllSec
.Lock();
2481 git_get_notes(commit
.m_hash
,¬e
);
2482 g_Git
.m_critGitDllSec
.Unlock();
2486 pRev
->m_Notes
.Empty();
2487 g_Git
.StringAppend(&pRev
->m_Notes
,(BYTE
*)note
);
2490 if(!pRev
->m_IsDiffFiles
)
2492 pRev
->m_CallDiffAsync
= DiffAsync
;
2495 pRev
->ParserParentFromCommit(&commit
);
2502 if(!m_sFilterText
.IsEmpty())
2504 if(!IsMatchFilter(bRegex
,pRev
,pat
))
2507 this->m_critSec
.Lock();
2508 m_logEntries
.push_back(hash
);
2509 m_arShownList
.SafeAdd(pRev
);
2510 this->m_critSec
.Unlock();
2512 if (lastSelectedHashNItem
== -1 && hash
== m_lastSelectedHash
)
2513 lastSelectedHashNItem
= (int)m_arShownList
.GetCount() - 1;
2517 if(t2
-t1
>500 || (m_logEntries
.size()-oldsize
>100))
2520 int percent
= (int)m_logEntries
.size() * 100 / total
+ GITLOG_START
+ 1;
2523 if(percent
< GITLOG_START
)
2524 percent
= GITLOG_START
+1;
2526 oldsize
= m_logEntries
.size();
2527 PostMessage(LVM_SETITEMCOUNT
, (WPARAM
) this->m_logEntries
.size(),(LPARAM
) LVSICF_NOINVALIDATEALL
|LVSICF_NOSCROLL
);
2529 //if( percent > oldprecentage )
2531 ::PostMessage(this->GetParent()->m_hWnd
,MSG_LOAD_PERCENTAGE
,(WPARAM
) percent
,0);
2532 oldprecentage
= percent
;
2537 g_Git
.m_critGitDllSec
.Lock();
2538 git_close_log(m_DllGitLog
);
2539 g_Git
.m_critGitDllSec
.Unlock();
2545 InterlockedExchange(&m_bThreadRunning
, FALSE
);
2550 PostMessage(LVM_SETITEMCOUNT
, (WPARAM
) this->m_logEntries
.size(),(LPARAM
) LVSICF_NOINVALIDATEALL
|LVSICF_NOSCROLL
);
2552 if (lastSelectedHashNItem
>= 0)
2553 PostMessage(m_ScrollToMessage
, lastSelectedHashNItem
);
2556 ::PostMessage(this->GetParent()->m_hWnd
,MSG_LOAD_PERCENTAGE
,(WPARAM
) GITLOG_END
,0);
2558 InterlockedExchange(&m_bThreadRunning
, FALSE
);
2563 void CGitLogListBase::Refresh(BOOL IsCleanFilter
)
2565 SafeTerminateThread();
2567 this->SetItemCountEx(0);
2572 // HACK to hide graph column
2573 if (m_ShowMask
& CGit::LOG_INFO_FOLLOW
)
2574 SetColumnWidth(0, 0);
2576 SetColumnWidth(0, m_ColumnManager
.GetWidth(0, false));
2578 //Update branch and Tag info
2580 //Assume Thread have exited
2581 //if(!m_bThreadRunning)
2583 m_logEntries
.clear();
2587 m_sFilterText
.Empty();
2592 InterlockedExchange(&m_bExitThread
,FALSE
);
2594 InterlockedExchange(&m_bThreadRunning
, TRUE
);
2595 InterlockedExchange(&m_bNoDispUpdates
, TRUE
);
2596 if ( (m_LoadingThread
=AfxBeginThread(LogThreadEntry
, this)) ==NULL
)
2598 InterlockedExchange(&m_bThreadRunning
, FALSE
);
2599 InterlockedExchange(&m_bNoDispUpdates
, FALSE
);
2600 CMessageBox::Show(NULL
, IDS_ERR_THREADSTARTFAILED
, IDS_APPNAME
, MB_OK
| MB_ICONERROR
);
2604 bool CGitLogListBase::ValidateRegexp(LPCTSTR regexp_str
, tr1::wregex
& pat
, bool bMatchCase
/* = false */)
2608 tr1::regex_constants::syntax_option_type type
= tr1::regex_constants::ECMAScript
;
2610 type
|= tr1::regex_constants::icase
;
2611 pat
= tr1::wregex(regexp_str
, type
);
2614 catch (exception
) {}
2617 BOOL
CGitLogListBase::IsMatchFilter(bool bRegex
, GitRev
*pRev
, tr1::wregex
&pat
)
2620 tr1::regex_constants::match_flag_type flags
= tr1::regex_constants::match_any
;
2623 if ((bRegex
)&&(m_bFilterWithRegex
))
2625 if (m_SelectedFilters
& LOGFILTER_BUGID
)
2627 if(this->m_bShowBugtraqColumn
)
2629 CString sBugIds
= m_ProjectProperties
.FindBugID(pRev
->GetSubject() + _T("\r\n\r\n") + pRev
->GetBody());
2631 ATLTRACE(_T("bugID = \"%s\"\n"), sBugIds
);
2632 if (regex_search(wstring(sBugIds
), pat
, flags
))
2639 if ((m_SelectedFilters
& LOGFILTER_SUBJECT
) || (m_SelectedFilters
& LOGFILTER_MESSAGES
))
2641 ATLTRACE(_T("messge = \"%s\"\n"), pRev
->GetSubject());
2642 if (regex_search(wstring((LPCTSTR
)pRev
->GetSubject()), pat
, flags
))
2648 if (m_SelectedFilters
& LOGFILTER_MESSAGES
)
2650 ATLTRACE(_T("messge = \"%s\"\n"),pRev
->GetBody());
2651 if (regex_search(wstring((LPCTSTR
)pRev
->GetBody()), pat
, flags
))
2657 if (m_SelectedFilters
& LOGFILTER_AUTHORS
)
2659 if (regex_search(wstring(pRev
->GetAuthorName()), pat
, flags
))
2664 if (regex_search(wstring(pRev
->GetCommitterName()), pat
, flags
))
2670 if (m_SelectedFilters
& LOGFILTER_REVS
)
2672 sRev
.Format(_T("%s"), pRev
->m_CommitHash
.ToString());
2673 if (regex_search(wstring((LPCTSTR
)sRev
), pat
, flags
))
2679 if (m_SelectedFilters
& LOGFILTER_PATHS
)
2681 CTGitPathList
*pathList
=NULL
;
2682 if( pRev
->m_IsDiffFiles
)
2683 pathList
= &pRev
->GetFiles(this);
2686 if(!pRev
->m_IsSimpleListReady
)
2687 pRev
->SafeGetSimpleList(&g_Git
);
2691 for (INT_PTR cpPathIndex
= 0; cpPathIndex
< pathList
->GetCount(); ++cpPathIndex
)
2693 if (regex_search(wstring((LPCTSTR
)pathList
->m_paths
.at(cpPathIndex
).GetGitOldPathString()), pat
, flags
))
2697 if (regex_search(wstring((LPCTSTR
)pathList
->m_paths
.at(cpPathIndex
).GetGitPathString()), pat
, flags
))
2703 for(size_t i
= 0; i
< pRev
->m_SimpleFileList
.size(); i
++)
2705 if (regex_search(wstring((LPCTSTR
)pRev
->m_SimpleFileList
[i
]), pat
, flags
))
2714 CString find
= m_sFilterText
;
2717 if (m_SelectedFilters
& LOGFILTER_BUGID
)
2719 if(this->m_bShowBugtraqColumn
)
2721 CString sBugIds
= m_ProjectProperties
.FindBugID(pRev
->GetSubject() + _T("\r\n\r\n") + pRev
->GetBody());
2723 sBugIds
.MakeLower();
2724 if ((sBugIds
.Find(find
) >= 0))
2731 if ((m_SelectedFilters
& LOGFILTER_SUBJECT
) || (m_SelectedFilters
& LOGFILTER_MESSAGES
))
2733 CString msg
= pRev
->GetSubject();
2735 msg
= msg
.MakeLower();
2736 if ((msg
.Find(find
) >= 0))
2742 if (m_SelectedFilters
& LOGFILTER_MESSAGES
)
2744 CString msg
= pRev
->GetBody();
2746 msg
= msg
.MakeLower();
2747 if ((msg
.Find(find
) >= 0))
2753 if (m_SelectedFilters
& LOGFILTER_AUTHORS
)
2755 CString msg
= pRev
->GetAuthorName();
2756 msg
= msg
.MakeLower();
2757 if ((msg
.Find(find
) >= 0))
2763 if (m_SelectedFilters
& LOGFILTER_REVS
)
2765 sRev
.Format(_T("%s"), pRev
->m_CommitHash
.ToString());
2766 if ((sRev
.Find(find
) >= 0))
2772 if (m_SelectedFilters
& LOGFILTER_PATHS
)
2774 CTGitPathList
*pathList
=NULL
;
2775 if( pRev
->m_IsDiffFiles
)
2776 pathList
= &pRev
->GetFiles(this);
2779 if(!pRev
->m_IsSimpleListReady
)
2780 pRev
->SafeGetSimpleList(&g_Git
);
2783 for (INT_PTR cpPathIndex
= 0; cpPathIndex
< pathList
->GetCount() ; ++cpPathIndex
)
2785 CTGitPath
*cpath
= &pathList
->m_paths
.at(cpPathIndex
);
2786 CString path
= cpath
->GetGitOldPathString();
2788 if ((path
.Find(find
)>=0))
2792 path
= cpath
->GetGitPathString();
2794 if ((path
.Find(find
)>=0))
2800 for (size_t i
= 0; i
< pRev
->m_SimpleFileList
.size(); i
++)
2802 CString path
= pRev
->m_SimpleFileList
[i
];
2804 if ((path
.Find(find
)>=0))
2810 } // else (from if (bRegex))
2815 void CGitLogListBase::RecalculateShownList(CThreadSafePtrArray
* pShownlist
)
2818 pShownlist
->SafeRemoveAll();
2820 tr1::wregex pat
;//(_T("Remove"), tr1::regex_constants::icase);
2821 bool bRegex
= false;
2822 if (m_bFilterWithRegex
)
2823 bRegex
= ValidateRegexp(m_sFilterText
, pat
, false);
2825 tr1::regex_constants::match_flag_type flags
= tr1::regex_constants::match_any
;
2827 for (DWORD i
=0; i
<m_logEntries
.size(); ++i
)
2829 if ((bRegex
)&&(m_bFilterWithRegex
))
2832 if ((m_nSelectedFilter
== LOGFILTER_ALL
)||(m_nSelectedFilter
== LOGFILTER_BUGID
))
2834 ATLTRACE(_T("bugID = \"%s\"\n"), (LPCTSTR
)m_logEntries
[i
]->sBugIDs
);
2835 if (regex_search(wstring((LPCTSTR
)m_logEntries
[i
]->sBugIDs
), pat
, flags
)&&IsEntryInDateRange(i
))
2837 pShownlist
->SafeAdd(m_logEntries
[i
]);
2842 if ((m_SelectedFilters
& LOGFILTER_SUBJECT
) || (m_SelectedFilters
& LOGFILTER_MESSAGES
))
2844 ATLTRACE(_T("messge = \"%s\"\n"),m_logEntries
.GetGitRevAt(i
).GetSubject());
2845 if (regex_search(wstring((LPCTSTR
)m_logEntries
.GetGitRevAt(i
).GetSubject()), pat
, flags
)&&IsEntryInDateRange(i
))
2847 pShownlist
->SafeAdd(&m_logEntries
.GetGitRevAt(i
));
2851 if (m_SelectedFilters
& LOGFILTER_MESSAGES
)
2853 ATLTRACE(_T("messge = \"%s\"\n"),m_logEntries
.GetGitRevAt(i
).GetBody());
2854 if (regex_search(wstring((LPCTSTR
)m_logEntries
.GetGitRevAt(i
).GetBody()), pat
, flags
)&&IsEntryInDateRange(i
))
2856 pShownlist
->SafeAdd(&m_logEntries
.GetGitRevAt(i
));
2860 if (m_SelectedFilters
& LOGFILTER_PATHS
)
2862 CTGitPathList pathList
= m_logEntries
.GetGitRevAt(i
).GetFiles(this);
2865 for (INT_PTR cpPathIndex
= 0; cpPathIndex
< pathList
.GetCount() && bGoing
; ++cpPathIndex
)
2867 CTGitPath cpath
= pathList
[cpPathIndex
];
2868 if (regex_search(wstring((LPCTSTR
)cpath
.GetGitOldPathString()), pat
, flags
)&&IsEntryInDateRange(i
))
2870 pShownlist
->SafeAdd(&m_logEntries
.GetGitRevAt(i
));
2874 if (regex_search(wstring((LPCTSTR
)cpath
.GetGitPathString()), pat
, flags
)&&IsEntryInDateRange(i
))
2876 pShownlist
->SafeAdd(&m_logEntries
.GetGitRevAt(i
));
2880 if (regex_search(wstring((LPCTSTR
)cpath
.GetActionName()), pat
, flags
)&&IsEntryInDateRange(i
))
2882 pShownlist
->SafeAdd(&m_logEntries
.GetGitRevAt(i
));
2888 if (m_SelectedFilters
& LOGFILTER_AUTHORS
)
2890 if (regex_search(wstring((LPCTSTR
)m_logEntries
.GetGitRevAt(i
).GetAuthorName()), pat
, flags
)&&IsEntryInDateRange(i
))
2892 pShownlist
->SafeAdd(&m_logEntries
.GetGitRevAt(i
));
2896 if (m_SelectedFilters
& LOGFILTER_REVS
)
2898 sRev
.Format(_T("%s"), m_logEntries
.GetGitRevAt(i
).m_CommitHash
.ToString());
2899 if (regex_search(wstring((LPCTSTR
)sRev
), pat
, flags
)&&IsEntryInDateRange(i
))
2901 pShownlist
->SafeAdd(&m_logEntries
.GetGitRevAt(i
));
2908 CString find
= m_sFilterText
;
2911 if ((m_nSelectedFilter
== LOGFILTER_ALL
)||(m_nSelectedFilter
== LOGFILTER_BUGID
))
2913 CString sBugIDs
= m_logEntries
[i
]->sBugIDs
;
2915 sBugIDs
= sBugIDs
.MakeLower();
2916 if ((sBugIDs
.Find(find
) >= 0)&&(IsEntryInDateRange(i
)))
2918 pShownlist
->SafeAdd(m_logEntries
[i
]);
2923 if ((m_SelectedFilters
& LOGFILTER_SUBJECT
) || (m_SelectedFilters
& LOGFILTER_MESSAGES
))
2925 CString msg
= m_logEntries
.GetGitRevAt(i
).GetSubject();
2927 msg
= msg
.MakeLower();
2928 if ((msg
.Find(find
) >= 0)&&(IsEntryInDateRange(i
)))
2930 pShownlist
->SafeAdd(&m_logEntries
.GetGitRevAt(i
));
2934 if (m_SelectedFilters
& LOGFILTER_MESSAGES
)
2936 CString msg
= m_logEntries
.GetGitRevAt(i
).GetBody();
2938 msg
= msg
.MakeLower();
2939 if ((msg
.Find(find
) >= 0)&&(IsEntryInDateRange(i
)))
2941 pShownlist
->SafeAdd(&m_logEntries
.GetGitRevAt(i
));
2945 if (m_SelectedFilters
& LOGFILTER_PATHS
)
2947 CTGitPathList pathList
= m_logEntries
.GetGitRevAt(i
).GetFiles(this);
2950 for (INT_PTR cpPathIndex
= 0; cpPathIndex
< pathList
.GetCount() && bGoing
; ++cpPathIndex
)
2952 CTGitPath cpath
= pathList
[cpPathIndex
];
2953 CString path
= cpath
.GetGitOldPathString();
2955 if ((path
.Find(find
)>=0)&&(IsEntryInDateRange(i
)))
2957 pShownlist
->SafeAdd(&m_logEntries
.GetGitRevAt(i
));
2961 path
= cpath
.GetGitPathString();
2963 if ((path
.Find(find
)>=0)&&(IsEntryInDateRange(i
)))
2965 pShownlist
->SafeAdd(&m_logEntries
.GetGitRevAt(i
));
2969 path
= cpath
.GetActionName();
2971 if ((path
.Find(find
)>=0)&&(IsEntryInDateRange(i
)))
2973 pShownlist
->SafeAdd(&m_logEntries
.GetGitRevAt(i
));
2979 if (m_SelectedFilters
& LOGFILTER_AUTHORS
)
2981 CString msg
= m_logEntries
.GetGitRevAt(i
).GetAuthorName();
2982 msg
= msg
.MakeLower();
2983 if ((msg
.Find(find
) >= 0)&&(IsEntryInDateRange(i
)))
2985 pShownlist
->SafeAdd(&m_logEntries
.GetGitRevAt(i
));
2989 if (m_SelectedFilters
& LOGFILTER_REVS
)
2991 sRev
.Format(_T("%s"), m_logEntries
.GetGitRevAt(i
).m_CommitHash
.ToString());
2992 if ((sRev
.Find(find
) >= 0)&&(IsEntryInDateRange(i
)))
2994 pShownlist
->SafeAdd(&m_logEntries
.GetGitRevAt(i
));
2998 } // else (from if (bRegex))
2999 } // for (DWORD i=0; i<m_logEntries.size(); ++i)
3003 BOOL
CGitLogListBase::IsEntryInDateRange(int /*i*/)
3006 __time64_t time = m_logEntries.GetGitRevAt(i).GetAuthorDate().GetTime();
3012 return time <= m_To;
3015 return time >= m_From;
3017 return ((time >= m_From)&&(time <= m_To));
3019 return TRUE
; /* git dll will filter time range */
3023 void CGitLogListBase::StartFilter()
3025 InterlockedExchange(&m_bNoDispUpdates
, TRUE
);
3026 RecalculateShownList(&m_arShownList
);
3027 InterlockedExchange(&m_bNoDispUpdates
, FALSE
);
3031 SetItemCountEx(ShownCountWithStopped());
3032 RedrawItems(0, ShownCountWithStopped());
3036 void CGitLogListBase::RemoveFilter()
3039 InterlockedExchange(&m_bNoDispUpdates
, TRUE
);
3041 m_arShownList
.SafeRemoveAll();
3043 // reset the time filter too
3045 m_timFrom
= (__time64_t(m_tFrom
));
3046 m_timTo
= (__time64_t(m_tTo
));
3047 m_DateFrom
.SetTime(&m_timFrom
);
3048 m_DateTo
.SetTime(&m_timTo
);
3049 m_DateFrom
.SetRange(&m_timFrom
, &m_timTo
);
3050 m_DateTo
.SetRange(&m_timFrom
, &m_timTo
);
3053 for (DWORD i
=0; i
<m_logEntries
.size(); ++i
)
3055 if(this->m_IsOldFirst
)
3057 m_arShownList
.SafeAdd(&m_logEntries
.GetGitRevAt(m_logEntries
.size()-i
-1));
3061 m_arShownList
.SafeAdd(&m_logEntries
.GetGitRevAt(i
));
3064 // InterlockedExchange(&m_bNoDispUpdates, FALSE);
3066 SetItemCountEx(ShownCountWithStopped());
3067 RedrawItems(0, ShownCountWithStopped());
3069 InterlockedExchange(&m_bNoDispUpdates
, FALSE
);
3072 void CGitLogListBase::Clear()
3074 m_arShownList
.SafeRemoveAll();
3077 m_logEntries
.ClearAll();
3081 void CGitLogListBase::OnDestroy()
3083 // save the column widths to the registry
3086 SafeTerminateThread();
3087 SafeTerminateAsyncDiffThread();
3090 while(m_LogCache
.SaveCache())
3098 //if(CMessageBox::Show(NULL,_T("Cannot Save Log Cache to Disk. To retry click yes. To give up click no."),_T("TortoiseGit"),
3099 // MB_YESNO) == IDNO)
3103 CHintListCtrl::OnDestroy();
3106 LRESULT
CGitLogListBase::OnLoad(WPARAM wParam
,LPARAM lParam
)
3108 UNREFERENCED_PARAMETER(lParam
);
3111 this->GetItemRect(i
,&rect
,LVIR_BOUNDS
);
3112 this->InvalidateRect(rect
);
3118 * Save column widths to the registry
3120 void CGitLogListBase::SaveColumnWidths()
3122 int maxcol
= m_ColumnManager
.GetColumnCount();
3124 // HACK that graph column is always shown
3125 SetColumnWidth(0, m_ColumnManager
.GetWidth(0, false));
3127 for (int col
= 0; col
< maxcol
; col
++)
3128 if (m_ColumnManager
.IsVisible (col
))
3129 m_ColumnManager
.ColumnResized (col
);
3131 m_ColumnManager
.WriteSettings();
3134 int CGitLogListBase::GetHeadIndex()
3136 if(m_HeadHash
.IsEmpty())
3139 for(int i
=0;i
<m_arShownList
.GetCount();i
++)
3141 GitRev
*pRev
= (GitRev
*)m_arShownList
[i
];
3144 if(pRev
->m_CommitHash
.ToString() == m_HeadHash
)
3150 void CGitLogListBase::OnFind()
3154 m_pFindDialog
= new CFindDlg(this);
3155 m_pFindDialog
->Create(this);
3158 void CGitLogListBase::OnHdnBegintrack(NMHDR
*pNMHDR
, LRESULT
*pResult
)
3160 m_ColumnManager
.OnHdnBegintrack(pNMHDR
, pResult
);
3162 void CGitLogListBase::OnHdnItemchanging(NMHDR
*pNMHDR
, LRESULT
*pResult
)
3164 if(!m_ColumnManager
.OnHdnItemchanging(pNMHDR
, pResult
))
3167 LRESULT
CGitLogListBase::OnScrollToMessage(WPARAM itemToSelect
, LPARAM
/*lParam*/)
3169 SetItemState((int)itemToSelect
, LVIS_SELECTED
, LVIS_SELECTED
);
3170 EnsureVisible((int)itemToSelect
, FALSE
);
3173 LRESULT
CGitLogListBase::OnFindDialogMessage(WPARAM
/*wParam*/, LPARAM
/*lParam*/)
3176 ASSERT(m_pFindDialog
!= NULL
);
3177 bool bFound
= false;
3180 if (m_pFindDialog
->IsTerminating())
3182 // invalidate the handle identifying the dialog box.
3183 m_pFindDialog
= NULL
;
3187 if(m_pFindDialog
->IsRef())
3190 str
=m_pFindDialog
->GetFindString();
3195 hash
= g_Git
.GetHash(str
+ _T("^{}")); // add ^{} in order to get the correct SHA-1 (especially for signed tags)
3199 for (i
= 0; i
<m_arShownList
.GetCount(); i
++)
3201 GitRev
* pLogEntry
= (GitRev
*)m_arShownList
.SafeGetAt(i
);
3202 if(pLogEntry
&& pLogEntry
->m_CommitHash
== hash
)
3212 if(m_pFindDialog
->FindNext())
3214 //read data from dialog
3215 CString FindText
= m_pFindDialog
->GetFindString();
3216 bool bMatchCase
= (m_pFindDialog
->MatchCase() == TRUE
);
3219 bool bRegex
= ValidateRegexp(FindText
, pat
, bMatchCase
);
3221 tr1::regex_constants::match_flag_type flags
= tr1::regex_constants::match_not_null
;
3224 for (i
= this->m_nSearchIndex
; i
<m_arShownList
.GetCount()&&!bFound
; i
++)
3226 GitRev
* pLogEntry
= (GitRev
*)m_arShownList
.SafeGetAt(i
);
3229 str
+=pLogEntry
->m_CommitHash
.ToString();
3232 for(int j
=0;j
<this->m_HashMap
[pLogEntry
->m_CommitHash
].size();j
++)
3234 str
+=m_HashMap
[pLogEntry
->m_CommitHash
][j
];
3238 str
+=pLogEntry
->GetAuthorEmail();
3240 str
+=pLogEntry
->GetAuthorName();
3242 str
+=pLogEntry
->GetBody();
3244 str
+=pLogEntry
->GetCommitterEmail();
3246 str
+=pLogEntry
->GetCommitterName();
3248 str
+=pLogEntry
->GetSubject();
3252 /*Because changed files list is loaded on demand when gui show,
3253 files will empty when files have not fetched.
3255 we can add it back by using one-way diff(with outnumber changed and rename detect.
3256 here just need changed filename list. one-way is much quicker.
3258 if(pLogEntry
->m_IsFull
)
3260 for(int i
=0;i
<pLogEntry
->GetFiles(this).GetCount();i
++)
3262 str
+=pLogEntry
->GetFiles(this)[i
].GetWinPath();
3264 str
+=pLogEntry
->GetFiles(this)[i
].GetGitOldPathString();
3270 if(!pLogEntry
->m_IsSimpleListReady
)
3271 pLogEntry
->SafeGetSimpleList(&g_Git
);
3273 for(int i
=0;i
<pLogEntry
->m_SimpleFileList
.size();i
++)
3275 str
+=pLogEntry
->m_SimpleFileList
[i
];
3284 if (regex_search(wstring(str
), pat
, flags
))
3294 if (str
.Find(FindText
) >= 0)
3304 msg
= msg
.MakeLower();
3305 CString find
= FindText
.MakeLower();
3306 if (msg
.Find(find
) >= 0)
3313 } // for (i = this->m_nSearchIndex; i<m_arShownList.GetItemCount()&&!bFound; i++)
3315 } // if(m_pFindDialog->FindNext())
3316 //UpdateLogInfoLabel();
3320 this->m_nSearchIndex
= i
;
3321 EnsureVisible(i
, FALSE
);
3322 SetItemState(GetSelectionMark(), 0, LVIS_SELECTED
);
3323 SetItemState(i
, LVIS_SELECTED
, LVIS_SELECTED
);
3324 SetSelectionMark(i
);
3325 //FillLogMessageCtrl();
3328 if (m_nSearchIndex
>= m_arShownList
.GetCount())
3329 m_nSearchIndex
= (int)m_arShownList
.GetCount()-1;
3335 void CGitLogListBase::OnColumnResized(NMHDR
*pNMHDR
, LRESULT
*pResult
)
3337 m_ColumnManager
.OnColumnResized(pNMHDR
,pResult
);
3342 void CGitLogListBase::OnColumnMoved(NMHDR
*pNMHDR
, LRESULT
*pResult
)
3344 m_ColumnManager
.OnColumnMoved(pNMHDR
, pResult
);